Package org.htmlunit.javascript.host.dom
Class CharacterData
- java.lang.Object
-
- org.htmlunit.corejs.javascript.ScriptableObject
-
- org.htmlunit.javascript.HtmlUnitScriptable
-
- org.htmlunit.javascript.host.event.EventTarget
-
- org.htmlunit.javascript.host.dom.Node
-
- org.htmlunit.javascript.host.dom.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 forCharacterData
.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.htmlunit.javascript.host.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
-
-
Constructor Summary
Constructors Constructor Description CharacterData()
Creates an instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.void
appendData(java.lang.String arg)
Append a string to character data.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.void
deleteData(int offset, int count)
Delete characters from character data.java.lang.Object
getData()
Gets the JavaScript propertydata
for this character data.private DomCharacterData
getDomCharacterDataOrDie()
int
getLength()
Gets the number of character in the character data.Element
getNextElementSibling()
Returns the next element sibling.Element
getPreviousElementSibling()
Returns the previous element sibling.void
insertData(int offset, java.lang.String arg)
Insert a string into character data.void
jsConstructor()
JavaScript constructor.void
remove()
Removes the DOM node from its parent.void
replaceData(int offset, int count, java.lang.String arg)
Replace characters of character data with a string.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.void
setData(java.lang.String newValue)
Sets the JavaScript propertydata
for this character data.java.lang.String
substringData(int offset, int count)
Extract a substring from character data.-
Methods inherited from class org.htmlunit.javascript.host.dom.Node
after, append, appendChild, before, cloneNode, compareDocumentPosition, contains, getAttributes, getBaseURI, getChildElementCount, getChildNodes, getChildren, getFirstChild, getFirstElementChild, getJavaScriptNode, getLastChild, getLastElementChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParent, getParentElement, getParentNode, getPrefix, getPreviousSibling, getRootNode, getTextContent, hasAttributes, hasChildNodes, insertBefore, insertBeforeImpl, isEqualNode, isSameNode, normalize, prepend, removeChild, replaceChild, replaceChildren, replaceWith, setNodeValue, setTextContent
-
Methods inherited from class org.htmlunit.javascript.host.event.EventTarget
addEventListener, clearEventListenersContainer, dispatchEvent, executeEventLocally, fireEvent, getEventHandler, getEventListenersContainer, hasEventHandlers, isEventHandlerOnWindow, removeEventListener, setEventHandler
-
Methods inherited from class org.htmlunit.javascript.HtmlUnitScriptable
clone, equivalentValues, get, getBrowserVersion, getClassName, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getStartingScope, getWindow, getWindow, getWithPreemption, has, hasInstance, initParentScope, makeScriptableFor, put, setClassName, setDomNode, setDomNode, setParentScope, setupPromise, setupRejectedPromise
-
Methods inherited from class org.htmlunit.corejs.javascript.ScriptableObject
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, get, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setPrototype, size
-
-
-
-
Method Detail
-
jsConstructor
public void jsConstructor()
JavaScript constructor.- Overrides:
jsConstructor
in classNode
-
getData
public java.lang.Object getData()
Gets the JavaScript propertydata
for this character data.- Returns:
- the String of data
-
setData
public void setData(java.lang.String newValue)
Sets the JavaScript propertydata
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 deletedcount
- 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 replacedarg
- 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 extractedcount
- 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 classNode
- See Also:
- MDN documentation
-
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 contextscope
- the scopethisObj
- this objectargs
- the argumentsfunction
- 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 contextscope
- the scopethisObj
- this objectargs
- the argumentsfunction
- 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 contextscope
- the scopethisObj
- this objectargs
- the argumentsfunction
- the function
-
-