Class CharacterData

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.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:
    Serialized Form
    • Constructor Detail

      • CharacterData

        public CharacterData()
        Creates an instance.
    • Method Detail

      • jsConstructor

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

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

        public void setData​(java.lang.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​(java.lang.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,
                               java.lang.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,
                                java.lang.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 java.lang.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
      • before

        public static void before​(org.htmlunit.corejs.javascript.Context context,
                                  org.htmlunit.corejs.javascript.Scriptable scope,
                                  org.htmlunit.corejs.javascript.Scriptable thisObj,
                                  java.lang.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,
                                 java.lang.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,
                                       java.lang.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