Package org.htmlunit.javascript.host
Class Element
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.Element
- 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:
HTMLElement
,SVGElement
A JavaScript object for
Element
.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate NamedNodeMap
private static final Pattern
private Map
<String, HTMLCollection> (package private) static final String
(package private) static final String
(package private) static final String
(package private) static final String
private static final Pattern
private static final Pattern
private int
private int
private CSSStyleDeclaration
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.static void
append
(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 objects or string objects after the last child of the Element.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.static Element
closest
(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) protected NamedNodeMap
Creates the JS object for the property attributes.protected void
createEventHandler
(String eventName, String attrValue) Create the event handler function from the attribute value.getAttribute
(String attributeName) getAttributeNode
(String name) Retrieves an attribute node by name.getAttributeNodeNS
(String namespaceURI, String localName) Returns the specified attribute.getAttributeNS
(String namespaceURI, String localName) Gets the specified attribute.Returns the attributes of this XML element.Retrieves an object that specifies the bounds of a collection of TextRectangle objects.int
Returns the current number of child elements.Gets the children of the current node.Gets the token list of class attribute.Returns the class defined for this element.int
Returns theclientHeight
attribute.int
Returns theclientLeft
attribute.Retrieves a collection of rectangles that describes the layout of the contents of an object or range within the client.int
ReturnsclientTop
attribute.int
Returns theclientWidth
attribute.Returns the DOM node that corresponds to this JavaScript object or throw an exception if one cannot be found.getElementsByClassName
(String className) Returns all the descendant elements with the specified class.getElementsByTagName
(String tagName) Returns all the descendant elements with the specified tag name.getElementsByTagNameNS
(Object namespaceURI, String localName) Returns a list of elements with the given tag name belonging to the given namespace.Returns the first element child.getId()
Returns the element ID.Gets theinnerHTML
attribute.protected String
getInnerHTML
(DomNode domNode) Helper for getInnerHtml (to be reuses bei HTMLTemplate.private Object[]
getInsertAdjacentLocation
(String where) Returns where and how to add the new node.Returns the last element child.Returns the local name of this attribute.Returns the URI that identifies an XML namespace.Returns the next element sibling.org.htmlunit.corejs.javascript.Function
Returns theonbeforecopy
event handler for this element.org.htmlunit.corejs.javascript.Function
Returns theonbeforecut
event handler for this element.org.htmlunit.corejs.javascript.Function
Returns theonbeforepaste
event handler for this element.org.htmlunit.corejs.javascript.Function
Returns theonsearch
event handler for this element.org.htmlunit.corejs.javascript.Function
Returns theonwebkitfullscreenchange
event handler for this element.org.htmlunit.corejs.javascript.Function
Returns theonwebkitfullscreenerror
event handler for this element.org.htmlunit.corejs.javascript.Function
Returns theonwheel
event handler for this element.Gets the outerHTML of the node.Gets the first ancestor instance ofElement
.Returns the namespace prefix.Returns the previous element sibling.int
Gets the scrollHeight for this element.int
Gets the scrollLeft value for this element.int
Gets the scrollTop value for this element.int
Gets the scrollWidth for this element.protected CSSStyleDeclaration
getStyle()
Returns the style object for this element.Returns the tag name of this element.boolean
hasAttribute
(String name) Returns true when an attribute with a given name is specified on this element or has a default value.boolean
hasAttributeNS
(String namespaceURI, String localName) Test for attribute.boolean
Returns true when the current element has any attributes or not.ThegetInnerHTML
function.insertAdjacentElement
(String where, Object insertedElement) Inserts the given element into the element at the location.void
insertAdjacentHTML
(String position, String text) Parses the given text as HTML or XML and inserts the resulting nodes into the tree in the position given by the position argument.void
insertAdjacentText
(String where, String text) Inserts the given text into the element at the specified location.protected final boolean
Returns whether thedisplay
isnone
or not.protected boolean
Returns whether the end tag is forbidden or not.void
JavaScript constructor.static boolean
matches
(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) Returns true if the element would be selected by the specified selector string; otherwise, returns false.static boolean
mozMatchesSelector
(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) Returns true if the element would be selected by the specified selector string; otherwise, returns false.private static void
parseHtmlSnippet
(DomNode target, String source) Parses the specified HTML source code, appending the resulting content at the specified target location.static void
prepend
(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 objects or string objects before the first child of the Element.protected final void
printChildren
(StringBuilder builder, DomNode node, boolean html) Helper for getting code back from nodes.protected void
printNode
(StringBuilder builder, DomNode node, boolean html) querySelector
(String selectors) Returns the first element within the document that matches the specified group of selectors.querySelectorAll
(String selectors) Retrieves all element nodes from descendants of the starting element node that match any selector within the supplied selector strings.void
Mock for the moment.void
remove()
Removes the DOM node from its parent.void
removeAttribute
(String name) Removes the specified attribute.void
removeAttributeNode
(Attr attribute) Removes the specified attribute.void
removeAttributeNS
(String namespaceURI, String localName) Removes the specified attribute.static void
replaceChildren
(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 existing children of a Node with a specified new set of children.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 with a set of Node or DOMString objects.void
scroll()
Implement thescroll()
JavaScript function but don't actually do anything.void
scrollBy()
Implement thescrollBy()
JavaScript function but don't actually do anything.void
Implement thescrollIntoView()
JavaScript function but don't actually do anything.void
Implement thescrollIntoViewIfNeeded()
JavaScript function but don't actually do anything.void
scrollTo()
Implement thescrollTo()
JavaScript function but don't actually do anything.void
setAttribute
(String name, String value) Sets an attribute.setAttributeNode
(Attr newAtt) Sets the attribute node for the specified attribute.void
setAttributeNS
(String namespaceURI, String qualifiedName, String value) Sets the specified attribute.void
setCapture
(boolean retargetToElement) Mock for the moment.void
setClassName_js
(String className) Sets the class attribute for this element.void
setDomNode
(DomNode domNode) Sets the DOM node that corresponds to this JavaScript object.void
Sets the id value for this element.void
setInnerHTML
(Object value) Replaces all child elements of this element with the supplied value.void
setOnbeforecopy
(Object onbeforecopy) Sets theonbeforecopy
event handler for this element.void
setOnbeforecut
(Object onbeforecut) Sets theonbeforecut
event handler for this element.void
setOnbeforepaste
(Object onbeforepaste) Sets theonbeforepaste
event handler for this element.void
setOnsearch
(Object onsearch) Sets theonsearch
event handler for this element.void
setOnwebkitfullscreenchange
(Object onwebkitfullscreenchange) Sets theonwebkitfullscreenchange
event handler for this element.void
setOnwebkitfullscreenerror
(Object onwebkitfullscreenerror) Sets theonwebkitfullscreenerror
event handler for this element.void
setOnwheel
(Object onwheel) Sets theonwheel
event handler for this element.void
setOuterHTML
(Object value) Replaces this element (including all child elements) with the supplied value.void
setScrollLeft
(int scroll) Sets the scrollLeft value for this element.void
setScrollTop
(int scroll) Sets the scrollTop value for this element.protected void
Sets the styles for this element.boolean
toggleAttribute
(String name, Object force) ThetoggleAttribute()
method of the Element interface toggles a Boolean attribute (removing it if it is present and adding it if it is not present) on the given element.static boolean
webkitMatchesSelector
(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) Returns true if the element would be selected by the specified selector string; otherwise, returns false.Methods inherited from class org.htmlunit.javascript.host.dom.Node
after, append, appendChild, before, cloneNode, compareDocumentPosition, contains, getBaseURI, getChildNodes, getFirstChild, getJavaScriptNode, getLastChild, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParent, getParentNode, getPreviousSibling, getRootNode, getTextContent, 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, getDomNodeOrNull, getPrototype, getScriptableFor, getStartingScope, getWindow, getWindow, getWithPreemption, has, hasInstance, initParentScope, makeScriptableFor, put, setClassName, 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
-
Field Details
-
POSITION_BEFORE_BEGIN
- See Also:
-
POSITION_AFTER_BEGIN
- See Also:
-
POSITION_BEFORE_END
- See Also:
-
POSITION_AFTER_END
- See Also:
-
CLASS_NAMES_SPLIT_PATTERN
-
PRINT_NODE_PATTERN
-
PRINT_NODE_QUOTE_PATTERN
-
attributes_
-
elementsByTagName_
-
scrollLeft_
private int scrollLeft_ -
scrollTop_
private int scrollTop_ -
style_
-
-
Constructor Details
-
Element
public Element()Default constructor.
-
-
Method Details
-
jsConstructor
public void jsConstructor()JavaScript constructor.- Overrides:
jsConstructor
in classNode
-
setDomNode
Sets the DOM node that corresponds to this JavaScript object.- Overrides:
setDomNode
in classHtmlUnitScriptable
- Parameters:
domNode
- the DOM node
-
createEventHandler
Create the event handler function from the attribute value.- Parameters:
eventName
- the event name (ex: "onclick")attrValue
- the attribute value
-
getTagName
Returns the tag name of this element.- Returns:
- the tag name
-
getAttributes
Returns the attributes of this XML element.- Overrides:
getAttributes
in classNode
- Returns:
- the attributes of this XML element
- See Also:
-
createAttributesObject
Creates the JS object for the property attributes. This object will the be cached.- Returns:
- the JS object
-
getAttribute
- Parameters:
attributeName
- attribute name- Returns:
- the value of the specified attribute,
null
if the attribute is not defined
-
setAttribute
Sets an attribute.- Parameters:
name
- Name of the attribute to setvalue
- Value to set the attribute to
-
getElementsByTagName
Returns all the descendant elements with the specified tag name.- Parameters:
tagName
- the name to search for- Returns:
- all the descendant elements with the specified tag name
-
getAttributeNode
Retrieves an attribute node by name.- Parameters:
name
- the name of the attribute to retrieve- Returns:
- the XMLAttr node with the specified name or
null
if there is no such attribute
-
getElementsByTagNameNS
Returns a list of elements with the given tag name belonging to the given namespace.- Parameters:
namespaceURI
- the namespace URI of elements to look forlocalName
- is either the local name of elements to look for or the special value "*", which matches all elements.- Returns:
- a live NodeList of found elements in the order they appear in the tree
-
hasAttribute
Returns true when an attribute with a given name is specified on this element or has a default value. See also the DOM reference- Parameters:
name
- the name of the attribute to look for- Returns:
- true if an attribute with the given name is specified on this element or has a default value
-
hasAttributes
public boolean hasAttributes()Returns true when the current element has any attributes or not.- Overrides:
hasAttributes
in classNode
- Returns:
- true if an attribute is specified on this element
-
getDomNodeOrDie
Returns the DOM node that corresponds to this JavaScript object or throw an exception if one cannot be found.- Overrides:
getDomNodeOrDie
in classHtmlUnitScriptable
- Returns:
- the DOM node
-
removeAttribute
Removes the specified attribute.- Parameters:
name
- the name of the attribute to remove
-
getBoundingClientRect
Retrieves an object that specifies the bounds of a collection of TextRectangle objects.- Returns:
- an object that specifies the bounds of a collection of TextRectangle objects
- See Also:
-
getChildElementCount
public int getChildElementCount()Returns the current number of child elements.- Overrides:
getChildElementCount
in classNode
- Returns:
- the child element count
-
getFirstElementChild
Returns the first element child.- Overrides:
getFirstElementChild
in classNode
- Returns:
- the first element child
-
getLastElementChild
Returns the last element child.- Overrides:
getLastElementChild
in classNode
- Returns:
- the last element child
-
getNextElementSibling
Returns the next element sibling.- Returns:
- the next element sibling
-
getPreviousElementSibling
Returns the previous element sibling.- Returns:
- the previous element sibling
-
getParentElement
Gets the first ancestor instance ofElement
. It is mostly identical toNode.getParent()
except that it skips nonElement
nodes.- Overrides:
getParentElement
in classNode
- Returns:
- the parent element
- See Also:
-
getChildren
Gets the children of the current node.- Overrides:
getChildren
in classNode
- Returns:
- the child at the given position
- See Also:
-
getClassList
Gets the token list of class attribute.- Returns:
- the token list of class attribute
-
getAttributeNS
Gets the specified attribute.- Parameters:
namespaceURI
- the namespace URIlocalName
- the local name of the attribute to look for- Returns:
- the value of the specified attribute,
null
if the attribute is not defined
-
hasAttributeNS
Test for attribute. See also the DOM reference- Parameters:
namespaceURI
- the namespace URIlocalName
- the local name of the attribute to look for- Returns:
true
if the node has this attribute
-
setAttributeNS
Sets the specified attribute.- Parameters:
namespaceURI
- the namespace URIqualifiedName
- the qualified name of the attribute to look forvalue
- the new attribute value
-
removeAttributeNS
Removes the specified attribute.- Parameters:
namespaceURI
- the namespace URI of the attribute to removelocalName
- the local name of the attribute to remove
-
setAttributeNode
Sets the attribute node for the specified attribute.- Parameters:
newAtt
- the attribute to set- Returns:
- the replaced attribute node, if any
-
querySelectorAll
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
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
-
getClassName_js
Returns the class defined for this element.- Returns:
- the class name
-
setClassName_js
Sets the class attribute for this element.- Parameters:
className
- the new class name
-
getClientHeight
public int getClientHeight()Returns theclientHeight
attribute.- Returns:
- the
clientHeight
attribute
-
getClientWidth
public int getClientWidth()Returns theclientWidth
attribute.- Returns:
- the
clientWidth
attribute
-
getClientLeft
public int getClientLeft()Returns theclientLeft
attribute.- Returns:
- the
clientLeft
attribute
-
getClientTop
public int getClientTop()ReturnsclientTop
attribute.- Returns:
- the
clientTop
attribute
-
getAttributeNodeNS
Returns the specified attribute.- Parameters:
namespaceURI
- the namespace URIlocalName
- the local name of the attribute to look for- Returns:
- the specified attribute,
null
if the attribute is not defined
-
getElementsByClassName
Returns all the descendant elements with the specified class.- Parameters:
className
- the name to search for- Returns:
- all the descendant elements with the specified class name
-
getClientRects
Retrieves a collection of rectangles that describes the layout of the contents of an object or range within the client. Each rectangle describes a single line.- Returns:
- a collection of rectangles that describes the layout of the contents
-
isDisplayNone
protected final boolean isDisplayNone()Returns whether thedisplay
isnone
or not.- Returns:
- whether the
display
isnone
or not
-
insertAdjacentElement
Inserts the given element into the element at the location.- Parameters:
where
- specifies where to insert the element, using one of the following values (case-insensitive): beforebegin, afterbegin, beforeend, afterendinsertedElement
- the element to be inserted- Returns:
- an element object
- See Also:
-
insertAdjacentText
Inserts the given text into the element at the specified location.- Parameters:
where
- specifies where to insert the text, using one of the following values (case-insensitive): beforebegin, afterbegin, beforeend, afterendtext
- the text to insert- See Also:
-
getInsertAdjacentLocation
Returns where and how to add the new node. Used byinsertAdjacentHTML(String, String)
,insertAdjacentElement(String, Object)
andinsertAdjacentText(String, String)
.- Parameters:
where
- specifies where to insert the element, using one of the following values (case-insensitive): beforebegin, afterbegin, beforeend, afterend- Returns:
- an array of 1-DomNode:parentNode and 2-Boolean:append
-
insertAdjacentHTML
Parses the given text as HTML or XML and inserts the resulting nodes into the tree in the position given by the position argument.- Parameters:
position
- specifies where to insert the nodes, using one of the following values (case-insensitive):beforebegin
,afterbegin
,beforeend
,afterend
text
- the text to parse- See Also:
-
parseHtmlSnippet
Parses the specified HTML source code, appending the resulting content at the specified target location.- Parameters:
target
- the node indicating the position at which the parsed content should be placedsource
- the HTML code extract to parse
-
innerHTML
ThegetInnerHTML
function.- Returns:
- the contents of this node as HTML
-
getInnerHTML
Gets theinnerHTML
attribute.- Returns:
- the contents of this node as HTML
-
setInnerHTML
Replaces all child elements of this element with the supplied value.- Parameters:
value
- the new value for the contents of this element
-
getInnerHTML
Helper for getInnerHtml (to be reuses bei HTMLTemplate.- Parameters:
domNode
- the node- Returns:
- the contents of this node as HTML
-
getOuterHTML
Gets the outerHTML of the node.- Returns:
- the contents of this node as HTML
- See Also:
-
setOuterHTML
Replaces this element (including all child elements) with the supplied value.- Parameters:
value
- the new value for replacing this element
-
printChildren
Helper for getting code back from nodes.- Parameters:
builder
- the builder to write tonode
- the node to be serializedhtml
- flag
-
printNode
-
isEndTagForbidden
protected boolean isEndTagForbidden()Returns whether the end tag is forbidden or not.- Returns:
- whether the end tag is forbidden or not
- See Also:
-
getId
Returns the element ID.- Returns:
- the ID of this element
-
setId
Sets the id value for this element.- Parameters:
newId
- the newId value for this element
-
removeAttributeNode
Removes the specified attribute.- Parameters:
attribute
- the attribute to remove
-
getScrollTop
public int getScrollTop()Gets the scrollTop value for this element.- Returns:
- the scrollTop value for this element
- See Also:
-
setScrollTop
public void setScrollTop(int scroll) Sets the scrollTop value for this element.- Parameters:
scroll
- the scrollTop value for this element
-
getScrollLeft
public int getScrollLeft()Gets the scrollLeft value for this element.- Returns:
- the scrollLeft value for this element
- See Also:
-
setScrollLeft
public void setScrollLeft(int scroll) Sets the scrollLeft value for this element.- Parameters:
scroll
- the scrollLeft value for this element
-
getScrollHeight
public int getScrollHeight()Gets the scrollHeight for this element.- Returns:
- at the moment the same as client height
- See Also:
-
getScrollWidth
public int getScrollWidth()Gets the scrollWidth for this element.- Returns:
- a dummy value of 10
- See Also:
-
getStyle
Returns the style object for this element.- Returns:
- the style object for this element
-
setStyle
Sets the styles for this element.- Parameters:
style
- the style of the element
-
scroll
public void scroll()Implement thescroll()
JavaScript function but don't actually do anything. The requirement is just to prevent scripts that call that method from failing -
scrollBy
public void scrollBy()Implement thescrollBy()
JavaScript function but don't actually do anything. The requirement is just to prevent scripts that call that method from failing -
scrollTo
public void scrollTo()Implement thescrollTo()
JavaScript function but don't actually do anything. The requirement is just to prevent scripts that call that method from failing -
scrollIntoView
public void scrollIntoView()Implement thescrollIntoView()
JavaScript function but don't actually do anything. The requirement is just to prevent scripts that call that method from failing -
scrollIntoViewIfNeeded
public void scrollIntoViewIfNeeded()Implement thescrollIntoViewIfNeeded()
JavaScript function but don't actually do anything. -
getPrefix
Returns the namespace prefix. -
getLocalName
Returns the local name of this attribute.- Overrides:
getLocalName
in classNode
- Returns:
- the local name of this attribute
-
getNamespaceURI
Returns the URI that identifies an XML namespace.- Overrides:
getNamespaceURI
in classNode
- Returns:
- the URI that identifies an XML namespace
-
getOnbeforecopy
public org.htmlunit.corejs.javascript.Function getOnbeforecopy()Returns theonbeforecopy
event handler for this element.- Returns:
- the
onbeforecopy
event handler for this element
-
setOnbeforecopy
Sets theonbeforecopy
event handler for this element.- Parameters:
onbeforecopy
- theonbeforecopy
event handler for this element
-
getOnbeforecut
public org.htmlunit.corejs.javascript.Function getOnbeforecut()Returns theonbeforecut
event handler for this element.- Returns:
- the
onbeforecut
event handler for this element
-
setOnbeforecut
Sets theonbeforecut
event handler for this element.- Parameters:
onbeforecut
- theonbeforecut
event handler for this element
-
getOnbeforepaste
public org.htmlunit.corejs.javascript.Function getOnbeforepaste()Returns theonbeforepaste
event handler for this element.- Returns:
- the
onbeforepaste
event handler for this element
-
setOnbeforepaste
Sets theonbeforepaste
event handler for this element.- Parameters:
onbeforepaste
- theonbeforepaste
event handler for this element
-
getOnsearch
public org.htmlunit.corejs.javascript.Function getOnsearch()Returns theonsearch
event handler for this element.- Returns:
- the
onsearch
event handler for this element
-
setOnsearch
Sets theonsearch
event handler for this element.- Parameters:
onsearch
- theonsearch
event handler for this element
-
getOnwebkitfullscreenchange
public org.htmlunit.corejs.javascript.Function getOnwebkitfullscreenchange()Returns theonwebkitfullscreenchange
event handler for this element.- Returns:
- the
onwebkitfullscreenchange
event handler for this element
-
setOnwebkitfullscreenchange
Sets theonwebkitfullscreenchange
event handler for this element.- Parameters:
onwebkitfullscreenchange
- theonwebkitfullscreenchange
event handler for this element
-
getOnwebkitfullscreenerror
public org.htmlunit.corejs.javascript.Function getOnwebkitfullscreenerror()Returns theonwebkitfullscreenerror
event handler for this element.- Returns:
- the
onwebkitfullscreenerror
event handler for this element
-
setOnwebkitfullscreenerror
Sets theonwebkitfullscreenerror
event handler for this element.- Parameters:
onwebkitfullscreenerror
- theonwebkitfullscreenerror
event handler for this element
-
getOnwheel
public org.htmlunit.corejs.javascript.Function getOnwheel()Returns theonwheel
event handler for this element.- Returns:
- the
onwheel
event handler for this element
-
setOnwheel
Sets theonwheel
event handler for this element.- Parameters:
onwheel
- theonwheel
event handler for this element
-
remove
public void remove()Removes the DOM node from its parent. -
setCapture
public void setCapture(boolean retargetToElement) Mock for the moment.- Parameters:
retargetToElement
- if true, all events are targeted directly to this element; if false, events can also fire at descendants of this element
-
releaseCapture
public void releaseCapture()Mock for the moment. -
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 with a set of Node or DOMString objects.- Parameters:
context
- the contextscope
- the scopethisObj
- this objectargs
- the argumentsfunction
- the function
-
matches
public static boolean matches(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) Returns true if the element would be selected by the specified selector string; otherwise, returns false.- Parameters:
context
- the JavaScript contextscope
- the scopethisObj
- the scriptableargs
- the arguments passed into the methodfunction
- the function- Returns:
- the value
-
mozMatchesSelector
public static boolean mozMatchesSelector(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) Returns true if the element would be selected by the specified selector string; otherwise, returns false.- Parameters:
context
- the JavaScript contextscope
- the scopethisObj
- the scriptableargs
- the arguments passed into the methodfunction
- the function- Returns:
- the value
-
webkitMatchesSelector
public static boolean webkitMatchesSelector(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) Returns true if the element would be selected by the specified selector string; otherwise, returns false.- Parameters:
context
- the JavaScript contextscope
- the scopethisObj
- the scriptableargs
- the arguments passed into the methodfunction
- the function- Returns:
- the value
-
closest
-
toggleAttribute
ThetoggleAttribute()
method of the Element interface toggles a Boolean attribute (removing it if it is present and adding it if it is not present) on the given element. Ifforce
istrue
, adds boolean attribute withname
. Ifforce
isfalse
, removes attribute withname
.- Parameters:
name
- the name of the attribute to be toggled. The attribute name is automatically converted to all lower-case when toggleAttribute() is called on an HTML element in an HTML document.force
- if true, the toggleAttribute method adds an attribute named name- Returns:
- true if attribute name is eventually present, and false otherwise
- See Also:
-
append
public static void append(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 objects or string objects after the last child of the Element. String objects are inserted as equivalent Text nodes.- Parameters:
context
- the contextscope
- the scopethisObj
- this objectargs
- the argumentsfunction
- the function
-
prepend
public static void prepend(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 objects or string objects before the first child of the Element. String objects are inserted as equivalent Text nodes.- Parameters:
context
- the contextscope
- the scopethisObj
- this objectargs
- the argumentsfunction
- the function
-
replaceChildren
public static void replaceChildren(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 existing children of a Node with a specified new set of children. These can be string or Node objects.- Parameters:
context
- the contextscope
- the scopethisObj
- this objectargs
- the argumentsfunction
- the function
-