Element

abstract external class Element : 
    Node,
    ParentNode,
    NonDocumentTypeChildNode,
    ChildNode,
    Slotable,
    GeometryUtils,
    UnionElementOrProcessingInstruction,
    UnionElementOrHTMLCollection,
    UnionElementOrRadioNodeList,
    UnionElementOrMouseEvent
(source)

Platform and version requirements: JS

Exposes the JavaScript Element to Kotlin

Constructors

<init>

Element()

Exposes the JavaScript Element to Kotlin

Properties

attributes

open val attributes: NamedNodeMap

classList

open val classList: DOMTokenList

className

open var className: String

clientHeight

open val clientHeight: Int

clientLeft

open val clientLeft: Int

clientTop

open val clientTop: Int

clientWidth

open val clientWidth: Int

id

open var id: String

innerHTML

open var innerHTML: String

localName

open val localName: String

namespaceURI

open val namespaceURI: String?

outerHTML

open var outerHTML: String

prefix

open val prefix: String?

scrollHeight

open val scrollHeight: Int

scrollLeft

open var scrollLeft: Double

scrollTop

open var scrollTop: Double

scrollWidth

open val scrollWidth: Int

shadowRoot

open val shadowRoot: ShadowRoot?

slot

open var slot: String

tagName

open val tagName: String

Inherited Properties

assignedSlot

abstract val assignedSlot: HTMLSlotElement?

baseURI

open val baseURI: String

childElementCount

abstract val childElementCount: Int

childNodes

open val childNodes: NodeList

children

abstract val children: HTMLCollection

firstChild

open val firstChild: Node?

firstElementChild

abstract val firstElementChild: Element?

isConnected

open val isConnected: Boolean

lastChild

open val lastChild: Node?

lastElementChild

abstract val lastElementChild: Element?

nextElementSibling

abstract val nextElementSibling: Element?

nextSibling

open val nextSibling: Node?

nodeName

open val nodeName: String

nodeType

open val nodeType: Short

nodeValue

open var nodeValue: String?

ownerDocument

open val ownerDocument: Document?

parentElement

open val parentElement: Element?

parentNode

open val parentNode: Node?

previousElementSibling

abstract val previousElementSibling: Element?

previousSibling

open val previousSibling: Node?

textContent

open var textContent: String?

Functions

attachShadow

fun attachShadow(init: ShadowRootInit): ShadowRoot

closest

fun closest(selectors: String): Element?

getAttribute

fun getAttribute(qualifiedName: String): String?

getAttributeNS

fun getAttributeNS(
    namespace: String?,
    localName: String
): String?

getAttributeNames

fun getAttributeNames(): Array<String>

getAttributeNode

fun getAttributeNode(qualifiedName: String): Attr?

getAttributeNodeNS

fun getAttributeNodeNS(
    namespace: String?,
    localName: String
): Attr?

getBoundingClientRect

fun getBoundingClientRect(): DOMRect

getClientRects

fun getClientRects(): Array<DOMRect>

getElementsByClassName

fun getElementsByClassName(
    classNames: String
): HTMLCollection

getElementsByTagName

fun getElementsByTagName(
    qualifiedName: String
): HTMLCollection

getElementsByTagNameNS

fun getElementsByTagNameNS(
    namespace: String?,
    localName: String
): HTMLCollection

hasAttribute

fun hasAttribute(qualifiedName: String): Boolean

hasAttributeNS

fun hasAttributeNS(
    namespace: String?,
    localName: String
): Boolean

hasAttributes

fun hasAttributes(): Boolean

insertAdjacentElement

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

insertAdjacentHTML

fun insertAdjacentHTML(position: String, text: String)

insertAdjacentText

fun insertAdjacentText(where: String, data: String)

matches

fun matches(selectors: String): Boolean

removeAttribute

fun removeAttribute(qualifiedName: String)

removeAttributeNS

fun removeAttributeNS(namespace: String?, localName: String)

removeAttributeNode

fun removeAttributeNode(attr: Attr): Attr

requestFullscreen

fun requestFullscreen(): Promise<Unit>

scroll

fun scroll(options: ScrollToOptions = definedExternally)
fun scroll(x: Double, y: Double)

scrollBy

fun scrollBy(options: ScrollToOptions = definedExternally)
fun scrollBy(x: Double, y: Double)

scrollIntoView

fun scrollIntoView()
fun scrollIntoView(arg: dynamic)

scrollTo

fun scrollTo(options: ScrollToOptions = definedExternally)
fun scrollTo(x: Double, y: Double)

setAttribute

fun setAttribute(qualifiedName: String, value: String)

setAttributeNS

fun setAttributeNS(
    namespace: String?,
    qualifiedName: String,
    value: String)

setAttributeNode

fun setAttributeNode(attr: Attr): Attr?

setAttributeNodeNS

fun setAttributeNodeNS(attr: Attr): Attr?

webkitMatchesSelector

fun webkitMatchesSelector(selectors: String): Boolean

Inherited Functions

after

abstract fun after(vararg nodes: dynamic)

append

abstract fun append(vararg nodes: dynamic)

appendChild

fun appendChild(node: Node): Node

before

abstract fun before(vararg nodes: dynamic)

cloneNode

fun cloneNode(deep: Boolean = definedExternally): Node

compareDocumentPosition

fun compareDocumentPosition(other: Node): Short

contains

fun contains(other: Node?): Boolean

convertPointFromNode

abstract fun convertPointFromNode(
    point: DOMPointInit,
    from: dynamic,
    options: ConvertCoordinateOptions = definedExternally
): DOMPoint

convertQuadFromNode

abstract fun convertQuadFromNode(
    quad: dynamic,
    from: dynamic,
    options: ConvertCoordinateOptions = definedExternally
): DOMQuad

convertRectFromNode

abstract fun convertRectFromNode(
    rect: DOMRectReadOnly,
    from: dynamic,
    options: ConvertCoordinateOptions = definedExternally
): DOMQuad

getBoxQuads

abstract fun getBoxQuads(
    options: BoxQuadOptions = definedExternally
): Array<DOMQuad>

getRootNode

fun getRootNode(
    options: GetRootNodeOptions = definedExternally
): Node

hasChildNodes

fun hasChildNodes(): Boolean

insertBefore

fun insertBefore(node: Node, child: Node?): Node

isDefaultNamespace

fun isDefaultNamespace(namespace: String?): Boolean

isEqualNode

fun isEqualNode(otherNode: Node?): Boolean

isSameNode

fun isSameNode(otherNode: Node?): Boolean

lookupNamespaceURI

fun lookupNamespaceURI(prefix: String?): String?

lookupPrefix

fun lookupPrefix(namespace: String?): String?

normalize

fun normalize()

prepend

abstract fun prepend(vararg nodes: dynamic)

querySelector

abstract fun querySelector(selectors: String): Element?

querySelectorAll

abstract fun querySelectorAll(selectors: String): NodeList

remove

abstract fun remove()

removeChild

fun removeChild(child: Node): Node

replaceChild

fun replaceChild(node: Node, child: Node): Node

replaceWith

abstract fun replaceWith(vararg nodes: dynamic)

Extension Properties

isElement

val Node.isElement: Boolean

Gets a value indicating whether this node is an Element.

isText

val Node.isText: Boolean

Gets a value indicating whether this node is a TEXT_NODE or a CDATA_SECTION_NODE.

Extension Functions

addClass

fun Element.addClass(vararg cssClasses: String): Boolean

Adds CSS class to element. Has no effect if all specified classes are already in class attribute of the element

appendElement

fun Element.appendElement(
    name: String,
    init: Element.() -> Unit
): Element

Appends a newly created element with the specified name to this element.

appendText

fun Element.appendText(text: String): Element

Creates text node and append it to the element.

clear

fun Node.clear()

Removes all the children from this node.

hasClass

fun Element.hasClass(cssClass: String): Boolean

Returns true if the element has the given CSS class style in its 'class' attribute

removeClass

fun Element.removeClass(vararg cssClasses: String): Boolean

Removes all cssClasses from element. Has no effect if all specified classes are missing in class attribute of the element

Inheritors

HTMLElement

abstract external class HTMLElement : 
    Element,
    ElementCSSInlineStyle,
    GlobalEventHandlers,
    DocumentAndElementEventHandlers,
    ElementContentEditable

Exposes the JavaScript HTMLElement to Kotlin

SVGElement

abstract external class SVGElement : 
    Element,
    ElementCSSInlineStyle,
    GlobalEventHandlers,
    SVGElementInstance

Exposes the JavaScript SVGElement to Kotlin