W3cubDocs

/Kotlin

Package kotlin.dom

Utility functions for working with the browser DOM.

Properties

Platform and version requirements: JS (1.1)

isElement

Gets a value indicating whether this node is an Element.

val Node.isElement: Boolean
Platform and version requirements: JS (1.1)

isText

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

val Node.isText: Boolean

Functions

Platform and version requirements: JS (1.1)

addClass

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

fun Element.addClass(vararg cssClasses: String): Boolean
Platform and version requirements: JS (1.1)

appendElement

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

fun Element.appendElement(
    name: String, 
    init: Element.() -> Unit
): Element
Platform and version requirements: JS (1.1)

appendText

Creates text node and append it to the element.

fun Element.appendText(text: String): Element
Platform and version requirements: JS (1.1)

clear

Removes all the children from this node.

fun Node.clear()
Platform and version requirements: JS (1.1)

createElement

Creates a new element with the specified name.

fun Document.createElement(
    name: String, 
    init: Element.() -> Unit
): Element
Platform and version requirements: JS (1.1)

hasClass

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

fun Element.hasClass(cssClass: String): Boolean
Platform and version requirements: JS (1.1)

removeClass

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

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

© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.dom/index.html