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:
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
A JavaScript object for
CharacterData
.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator
-
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
Fields inherited from class org.htmlunit.corejs.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
Fields inherited from interface org.htmlunit.corejs.javascript.Scriptable
NOT_FOUND
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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.void
appendData
(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, 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.getData()
Gets the JavaScript propertydata
for this character data.private DomCharacterData
int
Gets the number of character in the character data.Returns the next element sibling.Returns the previous element sibling.void
insertData
(int offset, String arg) Insert a string into character data.void
JavaScript constructor.void
remove()
Removes the DOM node from its parent.void
replaceData
(int offset, int count, 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, Object[] args, org.htmlunit.corejs.javascript.Function function) Replaces the node wit a set of Node or DOMString objects.void
Sets the JavaScript propertydata
for this character data.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
-
Constructor Details
-
CharacterData
public CharacterData()Creates an instance.
-
-
Method Details
-
jsConstructor
public void jsConstructor()JavaScript constructor.- Overrides:
jsConstructor
in classNode
-
getData
Gets the JavaScript propertydata
for this character data.- Returns:
- the String of data
-
setData
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
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
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
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
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
-
getNextElementSibling
Returns the next element sibling.- Returns:
- the next element sibling
-
getPreviousElementSibling
Returns the previous element sibling.- Returns:
- the previous element sibling
-
remove
public void remove()Removes the DOM node from its parent. -
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 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, 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, 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
-