DOMElement

EventTargetNodejs.html.DOMElement (extern class) → Element, js.html.svg.Element

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:

Instance Members

namespaceURI: 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


prefix: String

A DOMString representing the namespace prefix of the element, or null if no prefix is specified.


localName: String

A DOMString representing the local part of the qualified name of the element.


tagName: String

Returns a String with the name of the tag for the given element.


Is a DOMString representing the id of the element.


className: String

Is a DOMString representing the class of the element.


classList: DOMTokenList

Returns a DOMTokenList containing the list of class attributes.


attributes: NamedNodeMap

Returns a NamedNodeMap object containing the assigned attributes of the corresponding HTML element.


title: String

lang: String

dir: String

dataset: DOMStringMap

innerText: String

itemScope: Bool

itemType: DOMTokenList

itemId: String

itemRef: DOMTokenList

itemProp: DOMTokenList


itemValue: Dynamic

hidden: Bool

tabIndex: Int

accessKey: String

accessKeyLabel: String

draggable: Bool

contentEditable: String

isContentEditable: Bool

contextMenu: MenuElement

spellcheck: Bool





offsetParent: Element

offsetTop: Int

offsetLeft: Int

offsetWidth: Int

offsetHeight: Int

scrollTop: Int

A Number representing number of pixels the top of the document is scrolled vertically.


scrollLeft: Int

Is a Number representing the left scroll offset of the element.


scrollWidth: Int

Returns a Number representing the scroll view width of the element.


scrollHeight: Int

Returns a Number representing the scroll view height of an element.


clientTop: Int

Returns a Number representing the width of the top border of the element.


clientLeft: Int

Returns a Number representing the width of the left border of the element.


clientWidth: Int

Returns a Number representing the inner width of the element.


clientHeight: Int

Returns a Number representing the inner height of the element.


scrollTopMax: Int

Returns a Number representing the maximum top scroll offset possible for the element.


scrollLeftMax: Int

Returns a Number representing the maximum left scroll offset possible for the element.


innerHTML: String

Is a DOMString representing the markup of the element's content.


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.


shadowRoot: ShadowRoot

Returns the open shadow root that is hosted by the element, or null if no open shadow root is present.


assignedSlot: SlotElement

slot: String

Returns the name of the shadow DOM slot the element is inserted in.





onauxclick: haxe.Function

oncanplay: haxe.Function

oncanplaythrough: haxe.Function

onchange: haxe.Function



oncontextmenu: haxe.Function

ondblclick: haxe.Function


ondragend: haxe.Function

ondragenter: haxe.Function

ondragexit: haxe.Function

ondragleave: haxe.Function

ondragover: haxe.Function

ondragstart: haxe.Function


ondurationchange: haxe.Function

onemptied: haxe.Function



oninvalid: haxe.Function

onkeydown: haxe.Function

onkeypress: haxe.Function



onloadeddata: haxe.Function

onloadedmetadata: haxe.Function

onloadend: haxe.Function

onloadstart: haxe.Function

onmousedown: haxe.Function

onmouseenter: haxe.Function

onmouseleave: haxe.Function

onmousemove: haxe.Function

onmouseout: haxe.Function

onmouseover: haxe.Function

onmouseup: haxe.Function

Returns the event handling code for the wheel event. This is now implemented on GlobalEventHandlers.onwheel.




onplaying: haxe.Function

onprogress: haxe.Function

onratechange: haxe.Function


onresize: haxe.Function

onscroll: haxe.Function

onseeked: haxe.Function

onseeking: haxe.Function

onselect: haxe.Function


onstalled: haxe.Function

onsubmit: haxe.Function

onsuspend: haxe.Function

ontimeupdate: haxe.Function

onvolumechange: haxe.Function

onwaiting: haxe.Function

onselectstart: haxe.Function

ontoggle: haxe.Function

onpointercancel: haxe.Function

onpointerdown: haxe.Function

onpointerup: haxe.Function

onpointermove: haxe.Function

onpointerout: haxe.Function

onpointerover: haxe.Function

onpointerenter: haxe.Function

onpointerleave: haxe.Function

ongotpointercapture: haxe.Function

Returns the event handler for the gotpointercapture event type.


onlostpointercapture: haxe.Function

Returns the event handler for the lostpointercapture event type.


onanimationcancel: haxe.Function

onanimationend: haxe.Function

onanimationiteration: haxe.Function

onanimationstart: haxe.Function

ontransitioncancel: haxe.Function

ontransitionend: haxe.Function

ontransitionrun: haxe.Function

ontransitionstart: haxe.Function

onwebkitanimationend: haxe.Function

onwebkitanimationiteration: haxe.Function

onwebkitanimationstart: haxe.Function

onwebkittransitionend: haxe.Function

previousElementSibling: Element

nextElementSibling: Element


children: HTMLCollection

firstElementChild: Element

lastElementChild: Element

childElementCount: Int

ontouchstart: haxe.Function

ontouchend: haxe.Function

ontouchmove: haxe.Function

ontouchcancel: haxe.Function

getAttributeNames(): Array<String>

Returns an array of attribute names from the current element.

Returns
Array<String>

getAttribute(name: String): String

Retrieves the value of the named attribute from the current node and returns it as an Object.

Name Type
name String
Returns
String

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.

Name Type
namespace String
localName String
Returns
String

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.

Name Type Default
name String
force Bool (optional)
Returns
Bool

setAttribute(name: String, value: String): Void

Sets the value of a named attribute of the current node.

Name Type
name String
value String

setAttributeNS(namespace: String, name: String, value: String): Void

Sets the value of the attribute with the specified name and namespace, from the current node.

Name Type
namespace String
name String
value String

removeAttribute(name: String): Void

Removes the named attribute from the current node.

Name Type
name String

removeAttributeNS(namespace: String, localName: String): Void

Removes the attribute with the specified name and namespace, from the current node.

Name Type
namespace String
localName String

hasAttribute(name: String): Bool

Returns a Boolean indicating if the element has the specified attribute or not.

Name Type
name String
Returns
Bool

hasAttributeNS(namespace: String, localName: String): Bool

Returns a Boolean indicating if the element has the specified attribute, in the specified namespace, or not.

Name Type
namespace String
localName String
Returns
Bool

hasAttributes(): Bool

Returns a Boolean indicating if the element has one or more HTML attributes present.

Returns
Bool

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.

Name Type
selector String
Returns
Element

matches(selector: String): Bool

Returns a Boolean indicating whether or not the element would be selected by the specified selector string.

Name Type
selector String
Returns
Bool

webkitMatchesSelector(selector: String): Bool
Name Type
selector String
Returns
Bool

getElementsByTagName(localName: String): HTMLCollection

Returns a live HTMLCollection containing all descendant elements, of a particular tag name, from the current element.

Name Type
localName String
Returns
HTMLCollection

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.

Name Type
namespace String
localName String
Returns
HTMLCollection

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.

Name Type
classNames String
Returns
HTMLCollection

insertAdjacentElement(where: String, element: Element): Element

Inserts a given element node at a given position relative to the element it is invoked upon.

Name Type
where String
element Element
Returns
Element

insertAdjacentText(where: String, data: String): Void

Inserts a given text node at a given position relative to the element it is invoked upon.

Name Type
where String
data String

setPointerCapture(pointerId: Int): Void

Designates a specific element as the capture target of future pointer events.

Name Type
pointerId Int

releasePointerCapture(pointerId: Int): Void

Releases (stops) pointer capture that was previously set for a specific PointerEvent.

Name Type
pointerId Int

hasPointerCapture(pointerId: Int): Bool
Name Type
pointerId Int
Returns
Bool

setCapture(?retargetToElement: Bool = false): Void

Sets up mouse event capture, redirecting all mouse events to this element.

Name Type Default
retargetToElement Bool false

releaseCapture(): Void

getAttributeNode(name: String): Attr

Retrieves the node representation of the named attribute from the current node and returns it as an Attr.

Name Type
name String
Returns
Attr

setAttributeNode(newAttr: Attr): Attr

Sets the node representation of the named attribute from the current node.

Name Type
newAttr Attr
Returns
Attr

removeAttributeNode(oldAttr: Attr): Attr

Removes the node representation of the named attribute from the current node.

Name Type
oldAttr Attr
Returns
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.

Name Type
namespaceURI String
localName String
Returns
Attr

setAttributeNodeNS(newAttr: Attr): Attr

Sets the node representation of the attribute with the specified name and namespace, from the current node.

Name Type
newAttr Attr
Returns
Attr

click(): Void

focus(): Void

blur(): Void

getClientRects(): DOMRectList

Returns a collection of rectangles that indicate the bounding rectangles for each line of text in a client.

Returns
DOMRectList

getBoundingClientRect(): DOMRect

Returns the size of an element and its position relative to the viewport.

Returns
DOMRect

scrollIntoView(?arg: Bool): Void

Scrolls the page until the element gets into the view.

Name Type Default
arg Bool (optional)

scroll(?options: Null<ScrollToOptions>): Void
Name Type Default
options Null<ScrollToOptions> (optional)

scrollTo(?options: Null<ScrollToOptions>): Void
Name Type Default
options Null<ScrollToOptions> (optional)

scrollBy(?options: Null<ScrollToOptions>): Void
Name Type Default
options Null<ScrollToOptions> (optional)

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.

Name Type
position String
text String

querySelector(selectors: String): Element

Returns the first Node which matches the specified selector string relative to the element.

Name Type
selectors String
Returns
Element

querySelectorAll(selectors: String): NodeList

Returns a NodeList of nodes which match the specified selector string relative to the element.

Name Type
selectors String
Returns
NodeList

attachShadow(shadowRootInitDict: ShadowRootInit): ShadowRoot

Attatches a shadow DOM tree to the specified element and returns a reference to its ShadowRoot.

Name Type
shadowRootInitDict ShadowRootInit
Returns
ShadowRoot

requestFullscreen(?options: Null<FullscreenOptions>): js.lib.Promise<Void>

Asynchronously asks the browser to make the element full-screen.

Name Type Default
options Null<FullscreenOptions> (optional)
Returns
js.lib.Promise<Void>

requestPointerLock(): Void

Allows to asynchronously ask for the pointer to be locked on the given element.


animate(keyframes: Dynamic, ?options: Float): Animation

A shortcut method to create and run an animation on an element. Returns the created Animation object instance.

Name Type Default
keyframes Dynamic
options Float (optional)
Returns
Animation

getAnimations(?filter: Null<AnimationFilter>): Array<Animation>

Returns an array of Animation objects currently active on the element.

Name Type Default
filter Null<AnimationFilter> (optional)
Returns
Array<Animation>

before(nodes: haxe.extern.Rest): Void
Name Type
nodes haxe.extern.Rest

after(nodes: haxe.extern.Rest): Void
Name Type
nodes haxe.extern.Rest

replaceWith(nodes: haxe.extern.Rest): Void
Name Type
nodes haxe.extern.Rest

remove(): Void

convertQuadFromNode(quad: DOMQuad, from: Text, ?options: Null<ConvertCoordinateOptions>): DOMQuad
Name Type Default
quad DOMQuad
from Text
options Null<ConvertCoordinateOptions> (optional)
Returns
DOMQuad

convertRectFromNode(rect: DOMRectReadOnly, from: Text, ?options: Null<ConvertCoordinateOptions>): DOMQuad
Name Type Default
rect DOMRectReadOnly
from Text
options Null<ConvertCoordinateOptions> (optional)
Returns
DOMQuad

convertPointFromNode(point: DOMPointInit, from: Text, ?options: Null<ConvertCoordinateOptions>): DOMPoint
Name Type Default
point DOMPointInit
from Text
options Null<ConvertCoordinateOptions> (optional)
Returns
DOMPoint

prepend(nodes: haxe.extern.Rest): Void
Name Type
nodes haxe.extern.Rest

append(nodes: haxe.extern.Rest): Void
Name Type
nodes haxe.extern.Rest