Package org.htmlunit.javascript.host.dom
Class DocumentFragment
- 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.DocumentFragment
-
- 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:
ShadowRoot
public class DocumentFragment extends Node
A JavaScript object forDocumentFragment
.- See Also:
- W3C Dom Level 1, 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 DocumentFragment()
Creates an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getChildElementCount()
Returns the current number of child elements.HTMLCollection
getChildren()
Gets the children of the current node.java.lang.Object
getDefaultValue(java.lang.Class<?> hint)
Returns the JavaScript default value of this object.HtmlUnitScriptable
getElementById(java.lang.Object id)
Returns the element with the specified ID, ornull
if that element could not be found.Element
getFirstElementChild()
Returns the first element child.Element
getLastElementChild()
Returns the last element child.java.lang.Object
getRootNode()
Returns the owner document.void
jsConstructor()
JavaScript constructor.Node
querySelector(java.lang.String selectors)
Returns the first element within the document that matches the specified group of selectors.NodeList
querySelectorAll(java.lang.String selectors)
Retrieves all element nodes from descendants of the starting element node that match any selector within the supplied selector strings.-
Methods inherited from class org.htmlunit.javascript.host.dom.Node
after, append, appendChild, before, cloneNode, compareDocumentPosition, contains, getAttributes, getBaseURI, getChildNodes, getFirstChild, getJavaScriptNode, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParent, getParentElement, getParentNode, getPrefix, getPreviousSibling, getTextContent, hasAttributes, hasChildNodes, insertBefore, insertBeforeImpl, isEqualNode, isSameNode, normalize, prepend, remove, 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, 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
-
querySelectorAll
public NodeList querySelectorAll(java.lang.String selectors)
Retrieves all element nodes from descendants of the starting element node that match any selector within the supplied selector strings. The NodeList object returned by the querySelectorAll() method must be static, not live.- Parameters:
selectors
- the selectors- Returns:
- the static node list
-
querySelector
public Node querySelector(java.lang.String selectors)
Returns the first element within the document that matches the specified group of selectors.- Parameters:
selectors
- the selectors- Returns:
- null if no matches are found; otherwise, it returns the first matching element
-
getDefaultValue
public java.lang.Object getDefaultValue(java.lang.Class<?> hint)
Returns the JavaScript default value of this object. This is the JavaScript equivalent of a toString() in Java.- Specified by:
getDefaultValue
in interfaceorg.htmlunit.corejs.javascript.Scriptable
- Overrides:
getDefaultValue
in classHtmlUnitScriptable
- Parameters:
hint
- a hint as to the format of the default value (ignored in this case)- Returns:
- the default value
-
getChildElementCount
public int getChildElementCount()
Returns the current number of child elements.- Overrides:
getChildElementCount
in classNode
- Returns:
- the child element count
-
getFirstElementChild
public Element getFirstElementChild()
Returns the first element child.- Overrides:
getFirstElementChild
in classNode
- Returns:
- the first element child
-
getLastElementChild
public Element getLastElementChild()
Returns the last element child.- Overrides:
getLastElementChild
in classNode
- Returns:
- the last element child
-
getChildren
public HTMLCollection getChildren()
Gets the children of the current node.- Overrides:
getChildren
in classNode
- Returns:
- the child at the given position
- See Also:
- MSDN documentation
-
getElementById
public HtmlUnitScriptable getElementById(java.lang.Object id)
Returns the element with the specified ID, ornull
if that element could not be found.- Parameters:
id
- the ID to search for- Returns:
- the element, or
null
if it could not be found
-
getRootNode
public java.lang.Object getRootNode()
Returns the owner document.- Overrides:
getRootNode
in classNode
- Returns:
- the document
-
-