Class CharacterData

java.lang.Object
org.htmlunit.corejs.javascript.ScriptableObject
All Implemented Interfaces:
Serializable, Cloneable, org.htmlunit.corejs.javascript.ConstProperties, org.htmlunit.corejs.javascript.debug.DebuggableObject, org.htmlunit.corejs.javascript.Scriptable, org.htmlunit.corejs.javascript.SymbolScriptable
Direct Known Subclasses:
Comment, ProcessingInstruction, Text

public class CharacterData extends Node
A JavaScript object for CharacterData.
See Also:
  • Constructor Details

    • CharacterData

      public CharacterData()
      Creates an instance.
  • Method Details

    • jsConstructor

      public void jsConstructor()
      JavaScript constructor.
      Overrides:
      jsConstructor in class Node
    • getData

      public Object getData()
      Gets the JavaScript property data for this character data.
      Returns:
      the String of data
    • setData

      public void setData(String newValue)
      Sets the JavaScript property data for this character data.
      Parameters:
      newValue - the new String of data
    • getLength

      public int getLength()
      Gets the number of character in the character data.
      Returns:
      the number of characters
    • appendData

      public void appendData(String arg)
      Append a string to character data.
      Parameters:
      arg - the string to be appended to the character data
    • deleteData

      public void deleteData(int offset, int count)
      Delete characters from character data.
      Parameters:
      offset - the position of the first character to be deleted
      count - the number of characters to be deleted
    • insertData

      public void insertData(int offset, String arg)
      Insert a string into character data.
      Parameters:
      offset - the position within the first character at which the string is to be inserted.
      arg - the string to insert
    • replaceData

      public void replaceData(int offset, int count, String arg)
      Replace characters of character data with a string.
      Parameters:
      offset - the position within the first character at which the string is to be replaced.
      count - the number of characters to be replaced
      arg - the string that replaces the count characters beginning at the character at offset.
    • substringData

      public String substringData(int offset, int count)
      Extract a substring from character data.
      Parameters:
      offset - the position of the first character to be extracted
      count - the number of characters to be extracted
      Returns:
      a string that consists of the count characters of the character data starting from the character at position offset
    • getDomCharacterDataOrDie

      private DomCharacterData getDomCharacterDataOrDie()
    • getNextElementSibling

      public Element getNextElementSibling()
      Returns the next element sibling.
      Returns:
      the next element sibling
    • getPreviousElementSibling

      public Element getPreviousElementSibling()
      Returns the previous element sibling.
      Returns:
      the previous element sibling
    • remove

      public void remove()
      Removes the DOM node from its parent.
      Overrides:
      remove in class Node
      See Also:
    • before

      public static void before(org.htmlunit.corejs.javascript.Context context, org.htmlunit.corejs.javascript.Scriptable scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function function)
      Inserts a set of Node or DOMString objects in the children list of this ChildNode's parent, just before this ChildNode.
      Parameters:
      context - the context
      scope - the scope
      thisObj - this object
      args - the arguments
      function - the function
    • after

      public static void after(org.htmlunit.corejs.javascript.Context context, org.htmlunit.corejs.javascript.Scriptable scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function function)
      Inserts a set of Node or DOMString objects in the children list of this ChildNode's parent, just after this ChildNode.
      Parameters:
      context - the context
      scope - the scope
      thisObj - this object
      args - the arguments
      function - the function
    • replaceWith

      public static void replaceWith(org.htmlunit.corejs.javascript.Context context, org.htmlunit.corejs.javascript.Scriptable scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function function)
      Replaces the node wit a set of Node or DOMString objects.
      Parameters:
      context - the context
      scope - the scope
      thisObj - this object
      args - the arguments
      function - the function