Class ElementImpl
- All Implemented Interfaces:
Cloneable
,EventTarget
,ModelNode
,Element
,InnerHTML
,Node
,NonDocumentTypeChildNode
,ParentNode
,ScriptableDelegate
- Direct Known Subclasses:
HTMLElementImpl
ElementImpl class.
-
Field Summary
Fields inherited from class org.loboevolution.html.dom.nodeimpl.NodeImpl
document, nodeList, notificationsSuspended, parentNode, uiNode
Fields inherited from interface org.loboevolution.html.node.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, NONE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
appendOuterHTMLImpl
(StringBuilder buffer) appendOuterHTMLImpl.void
assignAttributeField
(String normalName, String value) int
calculateHeight
(boolean isBorder, boolean isPadding, boolean isClient) int
calculateWidth
(boolean isBorder, boolean isPadding, boolean isClient) <E extends Element>
EReturns the first (starting at element) inclusive ancestor that matches selectors, and null otherwise.getAttribute
(String name) Returns element's first attribute whose qualified name is qualifiedName, and null if there is no such attribute otherwise.String[]
Returns the qualified names of all element's attributes.getAttributeNode
(String name) getAttributeNode.getAttributeNodeNS
(String namespaceURI, String localName) getAttributeNodeNS.getAttributeNS
(String namespaceURI, String localName) Returns element's attribute whose namespace is namespace and local name is localName, and null if there is no such attribute otherwise.getAttributes.getBoundingClientRect.int
getChildElementCount.Allows for manipulation of element's class content attribute as a set of whitespace-separated tokens through a DOMTokenList object.Returns the value of element's class content attribute.int
getClientHeight.int
getClientLeft.getClientRects.int
getClientTop.getClientWidth.getDir()
getDir.getElementsByClassName
(String classNames) Returns a HTMLCollection of the elements in the object on which the method was invoked (a document or an element) that have all the classes given by classNames.getElementsByTagName
(String tagname) getElementsByTagName.getElementsByTagNameNS
(String namespaceURI, String localName) getElementsByTagNameNS.Returns the first child that is an element, and null otherwise.getId()
Getter for the field id.getInnerHTML.getInnerText.getLang()
getLang.Returns the last child that is an element, and null otherwise.getLocalName.Returns a string appropriate for the type of node.int
Returns the type of node.getNodeValue.getOuterHTML.protected String
getRawInnerText
(boolean includeComment) Gets inner text of the element, possibly including text in comments.getSchemaTypeInfo.double
getScrollHeight.double
getScrollLeft.double
getScrollTop.double
getScrollWidth.getSlot()
Returns the value of element's slot content attribute.Returns the HTML-uppercased qualified name.getTitle()
getTitle.boolean
hasAttribute
(String name) Returns true if element has an attribute whose qualified name is qualifiedName, and false otherwise.boolean
hasAttributeNS
(String namespaceURI, String localName) Returns true if element has an attribute whose namespace is namespace and local name is localName.boolean
Returns true if element has attributes, and false otherwise.boolean
hasPointerCapture
(int pointerId) hasPointerCapture.protected String
htmlEncodeChildText
(String text) htmlEncodeChildText.insertAdjacentElement
(String where, Node insertedElement) insertAdjacentElement.void
insertAdjacentHTML
(String position, String text) insertAdjacentHTML.boolean
isEqualNode
(Node arg) Returns whether node and otherNode have the same properties.boolean
Returns true if matching selectors against element's root yields element, and false otherwise.querySelector
(String selectors) Returns the first element that is a descendant of node that matches selectors.querySelectorAll
(String selector) Returns all element descendants of node that match selectors.void
releasePointerCapture
(int pointerId) releasePointerCapture.void
removeAttribute
(String name) Removes element's first attribute whose qualified name is qualifiedName.removeAttributeNode
(Attr oldAttr) removeAttributeNode.void
removeAttributeNS
(String namespaceURI, String localName) Removes element's attribute whose namespace is namespace and local name is localName.void
requestPointerLock.void
scroll
(int x, int y) scroll.void
scrollBy
(int x, int y) scrollBy.void
scrollIntoView.void
scrollIntoView
(boolean arg) scrollIntoView.void
scrollTo
(int x, int y) scrollTo.void
setAttribute
(String attrName, String value) Sets the value of element's first attribute whose qualified name is qualifiedName to value.setAttributeNode
(Attr newAttr) setAttributeNode.setAttributeNodeNS
(Attr newAttr) setAttributeNodeNS.void
setAttributeNS
(String namespaceURI, String qName, String value) Sets the value of element's attribute whose namespace is namespace and local name is localName to value.void
setClassName
(String className) setClassName.void
setDir.void
setId.void
setIdAttribute
(String localName, boolean isId) setIdAttribute.void
setIdAttributeNode
(Attr idAttr, boolean isId) setIdAttributeNode.void
setIdAttributeNS
(String namespaceURI, String localName, boolean isId) setIdAttributeNode.void
setInnerHTML
(String newHtml) setInnerHTML.void
setInnerText
(String newText) setInnerText.void
setLang.void
setNodeValue
(String nodeValue) setNodeValue.void
setOuterHTML
(String newHtml) setOuterHTML.void
setPointerCapture
(int pointerId) setPointerCapture.void
setScrollLeft
(double left) setScrollLeft.void
setScrollTop
(double scroll) setScrollTop.void
setSlot.void
setTitle.boolean
toggleAttribute
(String qualifiedName) toggleAttribute.boolean
toggleAttribute
(String qualifiedName, boolean force) If force is not given, "toggles" qualifiedName, removing it if it is present and adding it if it is not present.Methods inherited from class org.loboevolution.html.dom.nodeimpl.NodeImpl
appendChild, appendInnerHTMLImpl, appendInnerTextImpl, clone, cloneNode, cloneNode, compareDocumentPosition, contains, createRenderState, findUINode, forgetRenderState, getATTRIBUTE_NODE, getBaseURI, getCDATA_SECTION_NODE, getChildIndex, getChildNodes, getChildren, getCOMMENT_NODE, getDescendents, getDOCUMENT_FRAGMENT_NODE, getDOCUMENT_NODE, getDOCUMENT_POSITION_CONTAINED_BY, getDOCUMENT_POSITION_CONTAINS, getDOCUMENT_POSITION_DISCONNECTED, getDOCUMENT_POSITION_FOLLOWING, getDOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, getDOCUMENT_POSITION_PRECEDING, getDOCUMENT_TYPE_NODE, getDocumentItem, getDocumentNode, getDocumentURL, getELEMENT_NODE, getENTITY_NODE, getENTITY_REFERENCE_NODE, getFeature, getFirstChild, getFirstChildByFilter, getFullURL, getHtmlRendererConfig, getHtmlRendererContext, getLastChild, getNamespaceURI, getNextElementSibling, getNextSibling, getNodeList, getNONE, getNOTATION_NODE, getOwnerDocument, getParentElement, getParentModelNode, getParentNode, getParentRenderState, getPrefix, getPreviousElementSibling, getPreviousSibling, getPROCESSING_INSTRUCTION_NODE, getRenderState, getRootNode, getTEXT_NODE, getTextContent, getUINode, getUserAgentContext, getUserData, hasChildNodes, informInvalid, informLayoutInvalid, informLookInvalid, informNodeLoaded, informPositionInvalid, informSizeInvalid, informStructureInvalid, insertAfter, insertAt, insertBefore, isDefaultNamespace, isEqualOrDescendentOf, isIsConnected, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, prepend, prependChild, removeChild, removeChildAt, removeChildrenImpl, removeTableChildren, replaceAdjacentTextNodes, replaceChild, setDocumentItem, setOwnerDocument, setOwnerDocument, setParentImpl, setPrefix, setTextContent, setUINode, setUserData, toString, visit, visitImpl, warn, warn
Methods inherited from class org.loboevolution.html.dom.nodeimpl.event.EventTargetImpl
addEventListener, addEventListener, dispatchEvent, dispatchEvent, getFunction, removeEventListener, removeEventListener
Methods inherited from class org.loboevolution.js.AbstractScriptableDelegate
getScriptable, setScriptable
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.loboevolution.html.node.Element
getNamespaceURI, getPrefix
Methods inherited from interface org.loboevolution.events.EventTarget
addEventListener, addEventListener, dispatchEvent, dispatchEvent, removeEventListener, removeEventListener
Methods inherited from interface org.loboevolution.html.node.Node
appendChild, cloneNode, cloneNode, compareDocumentPosition, contains, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getNextSibling, getOwnerDocument, getParentElement, getParentNode, getPreviousSibling, getRootNode, getTextContent, getUserData, hasChildNodes, insertBefore, isDefaultNamespace, isIsConnected, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, prepend, prependChild, removeChild, replaceChild, setOwnerDocument, setPrefix, setTextContent, setUserData
Methods inherited from interface org.loboevolution.html.node.NonDocumentTypeChildNode
getNextElementSibling, getPreviousElementSibling
Methods inherited from interface org.loboevolution.html.node.ParentNode
getChildren
-
Constructor Details
-
ElementImpl
Constructor for ElementImpl.
- Parameters:
name
- aString
object.
-
-
Method Details
-
getAttribute
Returns element's first attribute whose qualified name is qualifiedName, and null if there is no such attribute otherwise.- Specified by:
getAttribute
in interfaceElement
- Parameters:
name
- aString
object.- Returns:
- a
String
object.
-
getAttributeNS
Returns element's attribute whose namespace is namespace and local name is localName, and null if there is no such attribute otherwise.- Specified by:
getAttributeNS
in interfaceElement
- Parameters:
namespaceURI
- aString
object.localName
- aString
object.- Returns:
- a
String
object. - Throws:
DOMException
-
getAttributeNode
getAttributeNode.
- Specified by:
getAttributeNode
in interfaceElement
- Parameters:
name
- aString
object.- Returns:
- a
Attr
object.
-
getAttributeNodeNS
@JSFunction public Attr getAttributeNodeNS(String namespaceURI, String localName) throws DOMException getAttributeNodeNS.
- Specified by:
getAttributeNodeNS
in interfaceElement
- Parameters:
namespaceURI
- aString
object.localName
- aString
object.- Returns:
- a
Attr
object. - Throws:
DOMException
-
removeAttribute
Removes element's first attribute whose qualified name is qualifiedName.- Specified by:
removeAttribute
in interfaceElement
- Parameters:
name
- aString
object.
-
removeAttributeNS
Removes element's attribute whose namespace is namespace and local name is localName.- Specified by:
removeAttributeNS
in interfaceElement
- Parameters:
namespaceURI
- aString
object.localName
- aString
object.- Throws:
DOMException
-
removeAttributeNode
removeAttributeNode.
- Specified by:
removeAttributeNode
in interfaceElement
- Parameters:
oldAttr
- aAttr
object.- Returns:
- a
Attr
object.
-
setAttribute
Sets the value of element's first attribute whose qualified name is qualifiedName to value.- Specified by:
setAttribute
in interfaceElement
- Parameters:
attrName
- aString
object.value
- aString
object.
-
setAttributeNS
Sets the value of element's attribute whose namespace is namespace and local name is localName to value.- Specified by:
setAttributeNS
in interfaceElement
- Parameters:
namespaceURI
- aString
object.qName
- aString
object.value
- aString
object.- Throws:
DOMException
-
setIdAttribute
setIdAttribute.
- Specified by:
setIdAttribute
in interfaceElement
- Parameters:
localName
- aString
object.isId
- a boolean.- Throws:
DOMException
-
setIdAttributeNS
public void setIdAttributeNS(String namespaceURI, String localName, boolean isId) throws DOMException setIdAttributeNode.
- Specified by:
setIdAttributeNS
in interfaceElement
- Parameters:
namespaceURI
- aString
object.localName
- aString
object.isId
- a boolean.- Throws:
DOMException
-
setIdAttributeNode
setIdAttributeNode.
- Specified by:
setIdAttributeNode
in interfaceElement
- Parameters:
idAttr
- aAttr
object.isId
- a boolean.
-
setAttributeNode
setAttributeNode.
- Specified by:
setAttributeNode
in interfaceElement
- Parameters:
newAttr
- aAttr
object.- Returns:
- a
Attr
object.
-
setAttributeNodeNS
setAttributeNodeNS.
- Specified by:
setAttributeNodeNS
in interfaceElement
- Parameters:
newAttr
- aAttr
object.- Returns:
- a
Attr
object. - Throws:
DOMException
-
getAttributes
getAttributes.
- Specified by:
getAttributes
in interfaceNode
- Overrides:
getAttributes
in classNodeImpl
- Returns:
- a
NamedNodeMap
object.
-
getDir
getDir.
- Returns:
- a
String
object.
-
getId
Getter for the field id.
-
getLang
getLang.
- Returns:
- a
String
object.
-
getLocalName
getLocalName.
- Specified by:
getLocalName
in interfaceElement
- Specified by:
getLocalName
in interfaceNode
- Specified by:
getLocalName
in classNodeImpl
- Returns:
- a
String
object.
-
getNodeName
Returns a string appropriate for the type of node.- Specified by:
getNodeName
in interfaceNode
- Specified by:
getNodeName
in classNodeImpl
- Returns:
- a
String
object.
-
getNodeType
public int getNodeType()Returns the type of node.- Specified by:
getNodeType
in interfaceNode
- Specified by:
getNodeType
in classNodeImpl
- Returns:
- a
Integer
object.
-
getNodeValue
Description copied from class:NodeImpl
getNodeValue.
- Specified by:
getNodeValue
in interfaceNode
- Specified by:
getNodeValue
in classNodeImpl
- Returns:
- a
String
object. - Throws:
DOMException
-
getRawInnerText
Gets inner text of the element, possibly including text in comments. This can be used to get Javascript code out of a SCRIPT element.- Parameters:
includeComment
- a boolean.- Returns:
- a
String
object.
-
getTagName
Returns the HTML-uppercased qualified name.- Specified by:
getTagName
in interfaceElement
- Returns:
- a
String
object.
-
getTitle
getTitle.
- Returns:
- a
String
object.
-
hasAttribute
Returns true if element has an attribute whose qualified name is qualifiedName, and false otherwise.- Specified by:
hasAttribute
in interfaceElement
- Parameters:
name
- aString
object.- Returns:
- a boolean.
-
hasAttributeNS
Returns true if element has an attribute whose namespace is namespace and local name is localName.- Specified by:
hasAttributeNS
in interfaceElement
- Parameters:
namespaceURI
- aString
object.localName
- aString
object.- Returns:
- a boolean.
- Throws:
DOMException
-
hasAttributes
public boolean hasAttributes()Returns true if element has attributes, and false otherwise.- Specified by:
hasAttributes
in interfaceNode
- Returns:
- a boolean.
-
htmlEncodeChildText
htmlEncodeChildText.
- Overrides:
htmlEncodeChildText
in classNodeImpl
- Parameters:
text
- aString
object.- Returns:
- a
String
object.
-
setDir
setDir.
- Parameters:
dir
- aString
object.
-
setId
setId.
-
setInnerText
setInnerText.
- Parameters:
newText
- aString
object.
-
setLang
setLang.
- Parameters:
lang
- aString
object.
-
setNodeValue
setNodeValue.
- Specified by:
setNodeValue
in interfaceNode
- Specified by:
setNodeValue
in classNodeImpl
- Parameters:
nodeValue
- aString
object.
-
setTitle
setTitle.
- Parameters:
title
- aString
object.
-
setInnerHTML
setInnerHTML.
- Specified by:
setInnerHTML
in interfaceInnerHTML
- Parameters:
newHtml
- aString
object.
-
getClassList
Allows for manipulation of element's class content attribute as a set of whitespace-separated tokens through a DOMTokenList object.- Specified by:
getClassList
in interfaceElement
- Returns:
- a
DOMTokenList
object.
-
getClassName
Returns the value of element's class content attribute. Can be set to change it.- Specified by:
getClassName
in interfaceElement
- Returns:
- a
String
object.
-
setClassName
setClassName.
- Specified by:
setClassName
in interfaceElement
- Parameters:
className
- aString
object.
-
getClientHeight
public int getClientHeight()getClientHeight.
- Specified by:
getClientHeight
in interfaceElement
- Returns:
- a
Integer
object.
-
getClientLeft
public int getClientLeft()getClientLeft.
- Specified by:
getClientLeft
in interfaceElement
- Returns:
- a
Integer
object.
-
getClientTop
public int getClientTop()getClientTop.
- Specified by:
getClientTop
in interfaceElement
- Returns:
- a
Integer
object.
-
getClientWidth
getClientWidth.
- Specified by:
getClientWidth
in interfaceElement
- Returns:
- a
Integer
object.
-
getInnerHTML
getInnerHTML.
- Specified by:
getInnerHTML
in interfaceElement
- Specified by:
getInnerHTML
in interfaceInnerHTML
- Returns:
- a
String
object.
-
getInnerText
getInnerText.
- Specified by:
getInnerText
in interfaceElement
- Returns:
- a
String
object.
-
getOuterHTML
getOuterHTML.
- Specified by:
getOuterHTML
in interfaceElement
- Returns:
- a
String
object.
-
setOuterHTML
setOuterHTML.
- Specified by:
setOuterHTML
in interfaceElement
- Parameters:
newHtml
- aString
object.
-
getSlot
Returns the value of element's slot content attribute. Can be set to change it. -
setSlot
setSlot.
-
closest
Returns the first (starting at element) inclusive ancestor that matches selectors, and null otherwise. -
getAttributeNames
Returns the qualified names of all element's attributes. Can contain duplicates.- Specified by:
getAttributeNames
in interfaceElement
- Returns:
- an array of
String
objects.
-
hasPointerCapture
public boolean hasPointerCapture(int pointerId) hasPointerCapture.
- Specified by:
hasPointerCapture
in interfaceElement
- Parameters:
pointerId
- aInteger
object.- Returns:
- a boolean.
-
matches
Returns true if matching selectors against element's root yields element, and false otherwise. -
releasePointerCapture
public void releasePointerCapture(int pointerId) releasePointerCapture.
- Specified by:
releasePointerCapture
in interfaceElement
- Parameters:
pointerId
- aInteger
object.
-
requestPointerLock
public void requestPointerLock()requestPointerLock.
- Specified by:
requestPointerLock
in interfaceElement
-
scroll
public void scroll(int x, int y) scroll.
-
scrollBy
public void scrollBy(int x, int y) scrollBy.
-
scrollIntoView
public void scrollIntoView(boolean arg) scrollIntoView.
- Specified by:
scrollIntoView
in interfaceElement
- Parameters:
arg
- a boolean.
-
scrollIntoView
public void scrollIntoView()scrollIntoView.
- Specified by:
scrollIntoView
in interfaceElement
-
scrollTo
public void scrollTo(int x, int y) scrollTo.
-
getScrollHeight
public double getScrollHeight()getScrollHeight.
- Specified by:
getScrollHeight
in interfaceElement
- Returns:
- a double.
-
getScrollLeft
public double getScrollLeft()getScrollLeft.
- Specified by:
getScrollLeft
in interfaceElement
- Returns:
- a double.
-
setScrollLeft
public void setScrollLeft(double left) setScrollLeft.
- Specified by:
setScrollLeft
in interfaceElement
- Parameters:
left
- aInteger
object.
-
getScrollTop
public double getScrollTop()getScrollTop.
- Specified by:
getScrollTop
in interfaceElement
- Returns:
- a double.
-
setScrollTop
public void setScrollTop(double scroll) setScrollTop.
- Specified by:
setScrollTop
in interfaceElement
- Parameters:
scroll
- aInteger
object.
-
getScrollWidth
public double getScrollWidth()getScrollWidth.
- Specified by:
getScrollWidth
in interfaceElement
- Returns:
- a double.
-
setPointerCapture
public void setPointerCapture(int pointerId) setPointerCapture.
- Specified by:
setPointerCapture
in interfaceElement
- Parameters:
pointerId
- aInteger
object.
-
toggleAttribute
If force is not given, "toggles" qualifiedName, removing it if it is present and adding it if it is not present. If force is true, adds qualifiedName. If force is false, removes qualifiedName.Returns true if qualifiedName is now present, and false otherwise.
- Specified by:
toggleAttribute
in interfaceElement
- Parameters:
qualifiedName
- aString
object.force
- a boolean.- Returns:
- a boolean.
-
toggleAttribute
toggleAttribute.
- Specified by:
toggleAttribute
in interfaceElement
- Parameters:
qualifiedName
- aString
object.- Returns:
- a boolean.
-
insertAdjacentElement
Description copied from interface:Element
insertAdjacentElement.
- Specified by:
insertAdjacentElement
in interfaceElement
- Parameters:
where
- aString
object.insertedElement
-Node
object.- Returns:
- a
Node
object.
-
insertAdjacentHTML
Description copied from interface:Element
insertAdjacentHTML.
- Specified by:
insertAdjacentHTML
in interfaceElement
- Parameters:
position
- aString
object.text
- aString
object.
-
getBoundingClientRect
getBoundingClientRect.
- Specified by:
getBoundingClientRect
in interfaceElement
- Returns:
- a
DOMRect
object.
-
getClientRects
getClientRects.
- Specified by:
getClientRects
in interfaceElement
- Returns:
- a
DOMRectList
object.
-
getSchemaTypeInfo
getSchemaTypeInfo.
- Specified by:
getSchemaTypeInfo
in interfaceElement
- Returns:
- a
TypeInfo
object.
-
getElementsByClassName
Returns a HTMLCollection of the elements in the object on which the method was invoked (a document or an element) that have all the classes given by classNames. The classNames argument is interpreted as a space-separated list of classes.- Specified by:
getElementsByClassName
in interfaceElement
- Parameters:
classNames
- aString
object.- Returns:
- a
HTMLCollection
object.
-
getElementsByTagName
getElementsByTagName.
- Specified by:
getElementsByTagName
in interfaceElement
- Parameters:
tagname
- aString
object.- Returns:
- a
HTMLCollection
object.
-
getElementsByTagNameNS
getElementsByTagNameNS.
- Specified by:
getElementsByTagNameNS
in interfaceElement
- Parameters:
namespaceURI
- aString
object.localName
- aString
object.- Returns:
- a
HTMLCollection
object.
-
getFirstElementChild
Returns the first child that is an element, and null otherwise.- Specified by:
getFirstElementChild
in interfaceParentNode
- Returns:
- a
Element
object.
-
getLastElementChild
Returns the last child that is an element, and null otherwise.- Specified by:
getLastElementChild
in interfaceParentNode
- Returns:
- a
Element
object.
-
getChildElementCount
public int getChildElementCount()getChildElementCount.
- Specified by:
getChildElementCount
in interfaceParentNode
- Returns:
- a
Integer
object.
-
querySelector
Returns the first element that is a descendant of node that matches selectors.- Specified by:
querySelector
in interfaceParentNode
- Parameters:
selectors
- aString
object.- Returns:
- a
Element
object.
-
querySelectorAll
Returns all element descendants of node that match selectors.- Specified by:
querySelectorAll
in interfaceParentNode
- Parameters:
selector
- aString
object.- Returns:
- a
NodeList
object.
-
assignAttributeField
-
isEqualNode
Description copied from class:NodeImpl
Returns whether node and otherNode have the same properties.- Specified by:
isEqualNode
in interfaceNode
- Overrides:
isEqualNode
in classNodeImpl
- Parameters:
arg
- aNode
object.- Returns:
- a boolean.
-
appendOuterHTMLImpl
appendOuterHTMLImpl.
- Parameters:
buffer
- aStringBuilder
object.
-
calculateWidth
public int calculateWidth(boolean isBorder, boolean isPadding, boolean isClient) -
calculateHeight
public int calculateHeight(boolean isBorder, boolean isPadding, boolean isClient)
-