package js.html
extends Node › EventTarget
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:
accessKey:Stringread onlyaccessKeyLabel:Stringread onlyassignedSlot:SlotElementread onlyattributes:NamedNodeMapReturns a NamedNodeMap object containing the assigned attributes of the corresponding HTML element.
read onlychildElementCount:Intread onlychildren:HTMLCollectionread onlyclassList:DOMTokenListReturns a DOMTokenList containing the list of class attributes.
className:StringIs a DOMString representing the class of the element.
read onlyclientHeight:IntReturns a Number representing the inner height of the element.
read onlyclientLeft:IntReturns a Number representing the width of the left border of the element.
read onlyclientTop:IntReturns a Number representing the width of the top border of the element.
read onlyclientWidth:IntReturns a Number representing the inner width of the element.
contentEditable:Stringread onlycontextMenu:MenuElementread onlydataset:DOMStringMapdir:Stringdraggable:Boolread onlyfirstElementChild:Elementhidden:Boolid:StringIs a DOMString representing the id of the element.
innerHTML:StringIs a DOMString representing the markup of the element's content.
innerText:Stringread onlyisContentEditable:BoolitemId:Stringread onlyitemProp:DOMTokenListread onlyitemRef:DOMTokenListitemScope:Boolread onlyitemType:DOMTokenListitemValue:Dynamiclang:Stringread onlylastElementChild:Elementread onlylocalName:StringA DOMString representing the local part of the qualified name of the element.
read onlynamespaceURI:StringThe 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
read onlynextElementSibling:Elementread onlyoffsetHeight:Intread onlyoffsetLeft:Intread onlyoffsetParent:Elementread onlyoffsetTop:Intread onlyoffsetWidth:Intonabort:Functiononanimationcancel:Functiononanimationend:Functiononanimationiteration:Functiononanimationstart:Functiononauxclick:Functiononblur:Functiononcanplay:Functiononcanplaythrough:Functiononchange:Functiononclick:Functiononclose:Functiononcontextmenu:Functiononcopy:Functiononcut:Functionondblclick:Functionondrag:Functionondragend:Functionondragenter:Functionondragexit:Functionondragleave:Functionondragover:Functionondragstart:Functionondrop:Functionondurationchange:Functiononemptied:Functiononended:Functiononerror:Functiononfocus:Functionongotpointercapture:FunctionReturns the event handler for the gotpointercapture event type.
oninput:Functiononinvalid:Functiononkeydown:Functiononkeypress:Functiononkeyup:Functiononload:Functiononloadeddata:Functiononloadedmetadata:Functiononloadend:Functiononloadstart:Functiononlostpointercapture:FunctionReturns the event handler for the lostpointercapture event type.
onmousedown:Functiononmouseenter:Functiononmouseleave:Functiononmousemove:Functiononmouseout:Functiononmouseover:Functiononmouseup:Functiononpaste:Functiononpause:Functiononplay:Functiononplaying:Functiononpointercancel:Functiononpointerdown:Functiononpointerenter:Functiononpointerleave:Functiononpointermove:Functiononpointerout:Functiononpointerover:Functiononpointerup:Functiononprogress:Functiononratechange:Functiononreset:Functiononresize:Functiononscroll:Functiononseeked:Functiononseeking:Functiononselect:Functiononselectstart:Functiononshow:Functiononstalled:Functiononsubmit:Functiononsuspend:Functionontimeupdate:Functionontoggle:Functionontouchcancel:Functionontouchend:Functionontouchmove:Functionontouchstart:Functionontransitioncancel:Functionontransitionend:Functionontransitionrun:Functionontransitionstart:Functiononvolumechange:Functiononwaiting:Functiononwebkitanimationend:Functiononwebkitanimationiteration:Functiononwebkitanimationstart:Functiononwebkittransitionend:Functiononwheel:FunctionReturns the event handling code for the wheel event. This is now implemented on GlobalEventHandlers.onwheel.
outerHTML:StringIs 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:StringA DOMString representing the namespace prefix of the element, or null if no prefix is specified.
read onlypreviousElementSibling:Elementread onlyproperties:HTMLPropertiesCollectionread onlyscrollHeight:IntReturns a Number representing the scroll view height of an element.
scrollLeft:IntIs a Number representing the left scroll offset of the element.
read onlyscrollLeftMax:IntReturns a Number representing the maximum left scroll offset possible for the element.
scrollTop:IntA Number representing number of pixels the top of the document is scrolled vertically.
read onlyscrollTopMax:IntReturns a Number representing the maximum top scroll offset possible for the element.
read onlyscrollWidth:IntReturns a Number representing the scroll view width of the element.
read onlyshadowRoot:ShadowRootReturns the open shadow root that is hosted by the element, or null if no open shadow root is present.
slot:StringReturns the name of the shadow DOM slot the element is inserted in.
spellcheck:Boolread onlystyle:CSSStyleDeclarationtabIndex:Intread onlytagName:StringReturns a String with the name of the tag for the given element.
title:Stringafter(nodes:Rest<Node>):Voidafter(nodes:Rest<String>):VoidThrows:
null |
DOMError |
|---|
animate(keyframes:Dynamic, ?options:Float):Animationanimate(keyframes:Dynamic, ?options:Null<KeyframeAnimationOptions>):AnimationA shortcut method to create and run an animation on an element. Returns the created Animation object instance.
Throws:
null |
DOMError |
|---|
append(nodes:Rest<Node>):Voidappend(nodes:Rest<String>):VoidThrows:
null |
DOMError |
|---|
attachShadow(shadowRootInitDict:ShadowRootInit):ShadowRootAttatches a shadow DOM tree to the specified element and returns a reference to its ShadowRoot.
Throws:
null |
DOMError |
|---|
before(nodes:Rest<Node>):Voidbefore(nodes:Rest<String>):VoidThrows:
null |
DOMError |
|---|
blur():VoidThrows:
null |
DOMError |
|---|
click():Voidclosest(selector:String):ElementReturns 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>):DOMPointconvertPointFromNode(point:DOMPointInit, from:Element, ?options:Null<ConvertCoordinateOptions>):DOMPointconvertPointFromNode(point:DOMPointInit, from:HTMLDocument, ?options:Null<ConvertCoordinateOptions>):DOMPointThrows:
null |
DOMError |
|---|
convertQuadFromNode(quad:DOMQuad, from:Text, ?options:Null<ConvertCoordinateOptions>):DOMQuadconvertQuadFromNode(quad:DOMQuad, from:Element, ?options:Null<ConvertCoordinateOptions>):DOMQuadconvertQuadFromNode(quad:DOMQuad, from:HTMLDocument, ?options:Null<ConvertCoordinateOptions>):DOMQuadThrows:
null |
DOMError |
|---|
convertRectFromNode(rect:DOMRectReadOnly, from:Text, ?options:Null<ConvertCoordinateOptions>):DOMQuadconvertRectFromNode(rect:DOMRectReadOnly, from:Element, ?options:Null<ConvertCoordinateOptions>):DOMQuadconvertRectFromNode(rect:DOMRectReadOnly, from:HTMLDocument, ?options:Null<ConvertCoordinateOptions>):DOMQuadThrows:
null |
DOMError |
|---|
focus():VoidThrows:
null |
DOMError |
|---|
getAnimations(?filter:Null<AnimationFilter>):Array<Animation>Returns an array of Animation objects currently active on the element.
getAttribute(name:String):StringRetrieves the value of the named attribute from the current node and returns it as an Object.
getAttributeNS(namespace:String, localName:String):StringRetrieves the value of the attribute with the specified name and namespace, from the current node and returns it as an Object.
getAttributeNames():Array<String>Returns an array of attribute names from the current element.
getAttributeNode(name:String):AttrRetrieves the node representation of the named attribute from the current node and returns it as an Attr.
getAttributeNodeNS(namespaceURI:String, localName:String):AttrRetrieves the node representation of the attribute with the specified name and namespace, from the current node and returns it as an Attr.
getBoundingClientRect():DOMRectReturns the size of an element and its position relative to the viewport.
getClientRects():DOMRectListReturns a collection of rectangles that indicate the bounding rectangles for each line of text in a client.
getElementsByClassName(classNames:String):HTMLCollectionReturns a live HTMLCollection that contains all descendants of the current element that possess the list of classes given in the parameter.
getElementsByTagName(localName:String):HTMLCollectionReturns a live HTMLCollection containing all descendant elements, of a particular tag name, from the current element.
getElementsByTagNameNS(namespace:String, localName:String):HTMLCollectionReturns a live HTMLCollection containing all descendant elements, of a particular tag name and namespace, from the current element.
Throws:
null |
DOMError |
|---|
hasAttribute(name:String):BoolReturns a Boolean indicating if the element has the specified attribute or not.
hasAttributeNS(namespace:String, localName:String):BoolReturns a Boolean indicating if the element has the specified attribute, in the specified namespace, or not.
hasAttributes():BoolReturns a Boolean indicating if the element has one or more HTML attributes present.
hasPointerCapture(pointerId:Int):BoolinsertAdjacentElement(where:String, element:Element):ElementInserts a given element node at a given position relative to the element it is invoked upon.
Throws:
null |
DOMError |
|---|
insertAdjacentHTML(position:String, text:String):VoidParses 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):VoidInserts a given text node at a given position relative to the element it is invoked upon.
Throws:
null |
DOMError |
|---|
matches(selector:String):BoolReturns a Boolean indicating whether or not the element would be selected by the specified selector string.
Throws:
null |
DOMError |
|---|
prepend(nodes:Rest<Node>):Voidprepend(nodes:Rest<String>):VoidThrows:
null |
DOMError |
|---|
querySelector(selectors:String):ElementReturns the first Node which matches the specified selector string relative to the element.
Throws:
null |
DOMError |
|---|
querySelectorAll(selectors:String):NodeListReturns a NodeList of nodes which match the specified selector string relative to the element.
Throws:
null |
DOMError |
|---|
releaseCapture():VoidreleasePointerCapture(pointerId:Int):VoidReleases (stops) pointer capture that was previously set for a specific PointerEvent.
Throws:
null |
DOMError |
|---|
remove():VoidremoveAttribute(name:String):VoidRemoves the named attribute from the current node.
Throws:
null |
DOMError |
|---|
removeAttributeNS(namespace:String, localName:String):VoidRemoves the attribute with the specified name and namespace, from the current node.
Throws:
null |
DOMError |
|---|
removeAttributeNode(oldAttr:Attr):AttrRemoves the node representation of the named attribute from the current node.
Throws:
null |
DOMError |
|---|
replaceWith(nodes:Rest<Node>):VoidreplaceWith(nodes:Rest<String>):VoidThrows:
null |
DOMError |
|---|
requestFullscreen():VoidAsynchronously asks the browser to make the element full-screen.
Throws:
null |
DOMError |
|---|
requestPointerLock():VoidAllows to asynchronously ask for the pointer to be locked on the given element.
scroll(?options:Null<ScrollToOptions>):Voidscroll(x:Float, y:Float):VoidscrollBy(?options:Null<ScrollToOptions>):VoidscrollBy(x:Float, y:Float):VoidscrollIntoView(?arg:Bool):VoidscrollIntoView(?arg:Null<ScrollIntoViewOptions>):VoidScrolls the page until the element gets into the view.
scrollTo(?options:Null<ScrollToOptions>):VoidscrollTo(x:Float, y:Float):VoidsetAttribute(name:String, value:String):VoidSets the value of a named attribute of the current node.
Throws:
null |
DOMError |
|---|
setAttributeNS(namespace:String, name:String, value:String):VoidSets the value of the attribute with the specified name and namespace, from the current node.
Throws:
null |
DOMError |
|---|
setAttributeNode(newAttr:Attr):AttrSets the node representation of the named attribute from the current node.
Throws:
null |
DOMError |
|---|
setAttributeNodeNS(newAttr:Attr):AttrSets the node representation of the attribute with the specified name and namespace, from the current node.
Throws:
null |
DOMError |
|---|
setCapture(retargetToElement:Bool = false):VoidSets up mouse event capture, redirecting all mouse events to this element.
setPointerCapture(pointerId:Int):VoidDesignates a specific element as the capture target of future pointer events.
Throws:
null |
DOMError |
|---|
toggleAttribute(name:String, ?force:Bool):BoolToggles a boolean attribute, removing it if it is present and adding it if it is not present, on the specified element.
Throws:
null |
DOMError |
|---|
webkitMatchesSelector(selector:String):BoolThrows:
null |
DOMError |
|---|
© 2005–2020 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/js/html/DOMElement.html