class DOMElement
package js.html
extends Node › EventTarget
extended by Element, Element
Available on js
Element
is the most general base class from which all objects in a Document
inherit. It only has methods and properties common to all kinds of elements. More specific classes inherit from Element
.
Documentation Element by Mozilla Contributors, licensed under CC-BY-SA 2.5.
See also:
Variables
read onlyattributes:NamedNodeMap
Returns a NamedNodeMap
object containing the assigned attributes of the corresponding HTML element.
read onlylocalName:String
A DOMString
representing the local part of the qualified name of the element.
read onlynamespaceURI:String
The namespace URI of the element, or null
if it is no namespace.
Note: In Firefox 3.5 and earlier, HTML elements are in no namespace. In later versions, HTML elements are in the http://www.w3.org/1999/xhtml
namespace in both HTML and XML trees. 1.9.2
onwheel:Function
Returns the event handling code for the wheel
event. This is now implemented on GlobalEventHandlers.onwheel
.
outerHTML:String
Is a DOMString
representing the markup of the element including its content. When used as a setter, replaces the element with nodes parsed from the given string.
read onlyprefix:String
A DOMString
representing the namespace prefix of the element, or null
if no prefix is specified.
read onlyscrollLeftMax:Int
Returns a Number
representing the maximum left scroll offset possible for the element.
read onlyscrollTopMax:Int
Returns a Number
representing the maximum top scroll offset possible for the element.
read onlyshadowRoot:ShadowRoot
Returns the open shadow root that is hosted by the element, or null if no open shadow root is present.
Methods
animate(keyframes:Dynamic, ?options:Float):Animation
animate(keyframes:Dynamic, ?options:Null<KeyframeAnimationOptions>):Animation
A shortcut method to create and run an animation on an element. Returns the created Animation object instance.
Throws:
null | DOMError |
---|
attachShadow(shadowRootInitDict:ShadowRootInit):ShadowRoot
Attatches a shadow DOM tree to the specified element and returns a reference to its ShadowRoot
.
Throws:
null | DOMError |
---|
closest(selector:String):Element
Returns the Element
which is the closest ancestor of the current element (or the current element itself) which matches the selectors given in parameter.
Throws:
null | DOMError |
---|
convertPointFromNode(point:DOMPointInit, from:Text, ?options:Null<ConvertCoordinateOptions>):DOMPoint
convertPointFromNode(point:DOMPointInit, from:Element, ?options:Null<ConvertCoordinateOptions>):DOMPoint
convertPointFromNode(point:DOMPointInit, from:HTMLDocument, ?options:Null<ConvertCoordinateOptions>):DOMPoint
Throws:
null | DOMError |
---|
convertQuadFromNode(quad:DOMQuad, from:Text, ?options:Null<ConvertCoordinateOptions>):DOMQuad
convertQuadFromNode(quad:DOMQuad, from:Element, ?options:Null<ConvertCoordinateOptions>):DOMQuad
convertQuadFromNode(quad:DOMQuad, from:HTMLDocument, ?options:Null<ConvertCoordinateOptions>):DOMQuad
Throws:
null | DOMError |
---|
convertRectFromNode(rect:DOMRectReadOnly, from:Text, ?options:Null<ConvertCoordinateOptions>):DOMQuad
convertRectFromNode(rect:DOMRectReadOnly, from:Element, ?options:Null<ConvertCoordinateOptions>):DOMQuad
convertRectFromNode(rect:DOMRectReadOnly, from:HTMLDocument, ?options:Null<ConvertCoordinateOptions>):DOMQuad
Throws:
null | DOMError |
---|
getAnimations(?filter:Null<AnimationFilter>):Array<Animation>
Returns an array of Animation objects currently active on the element.
getAttribute(name:String):String
Retrieves the value of the named attribute from the current node and returns it as an Object
.
getAttributeNS(namespace:String, localName:String):String
Retrieves the value of the attribute with the specified name and namespace, from the current node and returns it as an Object
.
getAttributeNode(name:String):Attr
Retrieves the node representation of the named attribute from the current node and returns it as an Attr
.
getAttributeNodeNS(namespaceURI:String, localName:String):Attr
Retrieves the node representation of the attribute with the specified name and namespace, from the current node and returns it as an Attr
.
getBoundingClientRect():DOMRect
Returns the size of an element and its position relative to the viewport.
getClientRects():DOMRectList
Returns a collection of rectangles that indicate the bounding rectangles for each line of text in a client.
getElementsByClassName(classNames:String):HTMLCollection
Returns a live HTMLCollection
that contains all descendants of the current element that possess the list of classes given in the parameter.
getElementsByTagName(localName:String):HTMLCollection
Returns a live HTMLCollection
containing all descendant elements, of a particular tag name, from the current element.
getElementsByTagNameNS(namespace:String, localName:String):HTMLCollection
Returns a live HTMLCollection
containing all descendant elements, of a particular tag name and namespace, from the current element.
Throws:
null | DOMError |
---|
hasAttribute(name:String):Bool
Returns a Boolean
indicating if the element has the specified attribute or not.
hasAttributeNS(namespace:String, localName:String):Bool
Returns a Boolean
indicating if the element has the specified attribute, in the specified namespace, or not.
hasAttributes():Bool
Returns a Boolean
indicating if the element has one or more HTML attributes present.
insertAdjacentElement(where:String, element:Element):Element
Inserts a given element node at a given position relative to the element it is invoked upon.
Throws:
null | DOMError |
---|
insertAdjacentHTML(position:String, text:String):Void
Parses the text as HTML or XML and inserts the resulting nodes into the tree in the position given.
Throws:
null | DOMError |
---|
insertAdjacentText(where:String, data:String):Void
Inserts a given text node at a given position relative to the element it is invoked upon.
Throws:
null | DOMError |
---|
matches(selector:String):Bool
Returns a Boolean
indicating whether or not the element would be selected by the specified selector string.
Throws:
null | DOMError |
---|
querySelector(selectors:String):Element
Returns the first Node
which matches the specified selector string relative to the element.
Throws:
null | DOMError |
---|
querySelectorAll(selectors:String):NodeList
Returns a NodeList
of nodes which match the specified selector string relative to the element.
Throws:
null | DOMError |
---|
releasePointerCapture(pointerId:Int):Void
Releases (stops) pointer capture that was previously set for a specific PointerEvent
.
Throws:
null | DOMError |
---|
removeAttribute(name:String):Void
Removes the named attribute from the current node.
Throws:
null | DOMError |
---|
removeAttributeNS(namespace:String, localName:String):Void
Removes the attribute with the specified name and namespace, from the current node.
Throws:
null | DOMError |
---|
removeAttributeNode(oldAttr:Attr):Attr
Removes the node representation of the named attribute from the current node.
Throws:
null | DOMError |
---|
requestFullscreen(?options:Null<FullscreenOptions>):Promise<Void>
Asynchronously asks the browser to make the element full-screen.
Throws:
null | DOMError |
---|
requestPointerLock():Void
Allows to asynchronously ask for the pointer to be locked on the given element.
scrollIntoView(?arg:Bool):Void
scrollIntoView(?arg:Null<ScrollIntoViewOptions>):Void
Scrolls the page until the element gets into the view.
setAttribute(name:String, value:String):Void
Sets the value of a named attribute of the current node.
Throws:
null | DOMError |
---|
setAttributeNS(namespace:String, name:String, value:String):Void
Sets the value of the attribute with the specified name and namespace, from the current node.
Throws:
null | DOMError |
---|
setAttributeNode(newAttr:Attr):Attr
Sets the node representation of the named attribute from the current node.
Throws:
null | DOMError |
---|
setAttributeNodeNS(newAttr:Attr):Attr
Sets the node representation of the attribute with the specified name and namespace, from the current node.
Throws:
null | DOMError |
---|
setCapture(retargetToElement:Bool = false):Void
Sets up mouse event capture, redirecting all mouse events to this element.
setPointerCapture(pointerId:Int):Void
Designates a specific element as the capture target of future pointer events.
Throws:
null | DOMError |
---|
toggleAttribute(name:String, ?force:Bool):Bool
Toggles a boolean attribute, removing it if it is present and adding it if it is not present, on the specified element.
Throws:
null | DOMError |
---|