DomApi

object DomApi
class Object
trait Matchable
class Any
DomApi.type

Value members

Concrete methods

def addEventListener[Ev <: Event](element: Base, listener: EventListener[Ev, _]): Unit

Events

Events

def appendChild(parent: Base, child: Base): Boolean

Tree functions

Tree functions

def createCommentNode(text: String): Comment

Comment Nodes

Comment Nodes

def createHtmlElement[Ref <: Element](tag: HtmlTag[Ref]): Ref

HTML Elements

HTML Elements

def createSvgElement[Ref <: Element](tag: SvgTag[Ref]): Ref
def createTextNode(text: String): Text

Text Nodes

Text Nodes

def debugNodeDescription(node: Node): String
Returns:

e.g. a, div#mainSection, span.sideNote.sizeSmall

def debugNodeInnerHtml(node: Node): String
def debugNodeOuterHtml(node: Node): String
def debugPath(element: Node, initial: List[String]): List[String]
Returns:

hierarchical path describing the position and identity of this node, starting with the root.

def getAriaAttribute[V](element: Base, attr: AriaAttr[V]): Option[V]

Aria attributes

Aria attributes

def getChecked(element: Element): UndefOr[Boolean]

Input related stuff

Input related stuff

def getHtmlAttribute[V, DomV](element: Base, attr: HtmlAttr[V]): Option[V]
def getHtmlProperty[V, DomV](element: Base, prop: HtmlProp[V, DomV]): V

#Note not sure if this is completely safe. Could this return null?

#Note not sure if this is completely safe. Could this return null?

def getSvgAttribute[V](element: Base, attr: SvgAttr[V]): Option[V]
def getValue(element: Element): UndefOr[String]
def insertBefore(parent: Base, newChild: Base, referenceChild: Base): Boolean
def isCustomElement(element: Element): Boolean

Custom Elements

Custom Elements

def removeAriaAttribute(element: Base, attr: AriaAttr[_]): Unit
def removeChild(parent: Base, child: Base): Boolean
def removeEventListener[Ev <: Event](element: Base, listener: EventListener[Ev, _]): Unit
def removeHtmlAttribute(element: Base, attr: HtmlAttr[_]): Unit
def removeSvgAttribute(element: Base, attr: SvgAttr[_]): Unit
def replaceChild(parent: Base, newChild: Base, oldChild: Base): Boolean
def setAriaAttribute[V](element: Base, attr: AriaAttr[V], value: V): Unit
def setChecked(element: Element, checked: Boolean): Boolean
Returns:

whether the operation succeeded

def setCommentNodeText(node: CommentNode, text: String): Unit
def setHtmlAnyStyle[V](element: Base, style: StyleProp[V], value: V | String): Unit
def setHtmlAttribute[V](element: Base, attr: HtmlAttr[V], value: V): Unit
def setHtmlProperty[V, DomV](element: Base, prop: HtmlProp[V, DomV], value: V): Unit
def setHtmlStringStyle(element: Base, style: StyleProp[_], value: String): Unit
def setHtmlStyle[V](element: Base, style: StyleProp[V], value: V): Unit
def setSvgAttribute[V](element: Base, attr: SvgAttr[V], value: V): Unit
def setTextNodeText(node: TextNode, text: String): Unit
def setValue(element: Element, value: String): Boolean
Returns:

whether the operation succeeded

def unsafeParseHtmlString(dangerousHtmlString: String): Element

#WARNING: HTML can contain Javascript code, which this function will execute blindly! Only use on trusted HTML strings.

#WARNING: HTML can contain Javascript code, which this function will execute blindly! Only use on trusted HTML strings.

def unsafeParseHtmlString[Ref <: Element](tag: HtmlTag[Ref], dangerousHtmlString: String): Ref

#WARNING: HTML can contain Javascript code, which this function will execute blindly! Only use on trusted HTML strings.

#WARNING: HTML can contain Javascript code, which this function will execute blindly! Only use on trusted HTML strings.

Value parameters:
tag

the HTML tag you expect from parsing. Will throw exception if does not match the result.

def unsafeParseSvgString(dangerousSvgString: String): Element

#WARNING: SVG can contain Javascript code, which this function will execute blindly! Only use on trusted SVG strings.

#WARNING: SVG can contain Javascript code, which this function will execute blindly! Only use on trusted SVG strings.

def unsafeParseSvgString[Ref <: Element](tag: SvgTag[Ref], dangerousSvgString: String): Ref

#WARNING: SVG can contain Javascript code, which this function will be execute blindly! Only use on trusted SVG strings.

#WARNING: SVG can contain Javascript code, which this function will be execute blindly! Only use on trusted SVG strings.

Value parameters:
tag

the SVG tag you expect from parsing. Will throw exception if does not match the result.