DomApi

com.raquo.laminar.DomApi$
object DomApi

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
DomApi.type

Members list

Value members

Concrete methods

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

Events

Events

Attributes

def appendChild(parent: Node, child: Node): Boolean
def assertHtmlElement(node: Node, clue: String): Element
def assertSingleNode(nodes: Array[Node], clue: String): Node
def assertSvgElement(node: Node, clue: String): Element
def assertTagMatches[Ref <: Element](tag: Tag[ReactiveElement[Ref]], node: Node, clue: String): Ref
def createCommentNode(text: String): Comment

Comment Nodes

Comment Nodes

Attributes

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

HTML Elements

HTML Elements

Attributes

def createSvgElement[Ref <: Element](tag: SvgTag[Ref]): Ref

SVG Elements

SVG Elements

Attributes

def createTextNode(text: String): Text

Text Nodes

Text Nodes

Attributes

def debugNodeDescription(node: Node): String

Attributes

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]

Attributes

Returns

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

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

Aria attributes

Aria attributes

Attributes

def getAriaAttributeRaw(element: Base, attr: AriaAttr[_]): UndefOr[String]
def getChecked(element: Element): UndefOr[Boolean]

Input related stuff

Input related stuff

Attributes

def getFiles(element: Element): UndefOr[List[File]]
def getHtmlAttribute[V](element: Base, attr: HtmlAttr[V]): UndefOr[V]

HTML Attributes

HTML Attributes

Attributes

def getHtmlAttributeRaw(element: Base, attr: HtmlAttr[_]): UndefOr[String]
def getHtmlProperty[V, DomV](element: Base, prop: HtmlProp[V, DomV]): UndefOr[V]

Returns js.undefined when the property is missing on the element. If the element type supports this property, it should never be js.undefined.

Returns js.undefined when the property is missing on the element. If the element type supports this property, it should never be js.undefined.

Attributes

def getHtmlPropertyRaw[V, DomV](element: Base, prop: HtmlProp[V, DomV]): UndefOr[DomV]
def getHtmlStyleRaw(element: Base, styleProp: StyleProp[_]): String

Note: this only gets inline style values – those set via the style attribute, which includes all style props set by Laminar. It does not account for CSS declarations in <style> tags.

Note: this only gets inline style values – those set via the style attribute, which includes all style props set by Laminar. It does not account for CSS declarations in <style> tags.

Returns empty string if the given style property is not defined in this element's inline styles.

See https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleDeclaration/getPropertyValue Contrast with https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle

Attributes

def getSvgAttribute[V](element: Base, attr: SvgAttr[V]): UndefOr[V]

SVG Attributes

SVG Attributes

Attributes

def getSvgAttributeRaw(element: Base, attr: SvgAttr[_]): UndefOr[String]
def getValue(element: Element): UndefOr[String]
def indexOfChild(parent: Node, child: Node): Int

Tree query functions

Tree query functions

Attributes

def insertAfter(parent: Node, newChild: Node, referenceChild: Node): Boolean
def insertBefore(parent: Node, newChild: Node, referenceChild: Node): Boolean
def isCustomElement(element: Element): Boolean

Custom Elements

Custom Elements

Attributes

final def isDescendantOf(node: Node, ancestor: Node): Boolean

Note: This walks up the real DOM element tree, not the Laminar DOM tree. See ChildNode.isDescendantOf if you want to walk up Laminar's tree instead.

Note: This walks up the real DOM element tree, not the Laminar DOM tree. See ChildNode.isDescendantOf if you want to walk up Laminar's tree instead.

Attributes

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

Attributes

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, styleProp: StyleProp[_], value: String): Unit
def setHtmlStyle[V](element: Base, styleProp: 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

Attributes

Returns

whether the operation succeeded

def unsafeParseHtmlString(dangerousHtmlString: String): Element

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

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

Note: this expects the html string to contain one HTML element, and will throw otherwise (e.g. if given a text node, an SVG, or multiple elements)

Attributes

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

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

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

Note: this expects the html string to contain one element matching the tag name, and will throw otherwise (e.g. if given a text node, an element with a different tag name, or multiple elements)

Attributes

def unsafeParseHtmlStringIntoNodeArray(dangerousHtmlString: String): Array[Node]

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

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

Note: This method does not work in Internet Explorer. See https://stackoverflow.com/q/10585029 for the issues with various approaches. Use this if you need IE support: https://gist.github.com/Munawwar/6e6362dbdf77c7865a99

Attributes

def unsafeParseSvgString(dangerousSvgString: String): Element

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

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

Note: this expects the svg string to contain one HTML element, and will throw otherwise (e.g. if given a text node, HTML, or multiple elements)

Attributes

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

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

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

Note: this expects the svg string to contain one element matching the tag name, and will throw otherwise (e.g. if given a text node, an element with a different tag name, or multiple elements)

Attributes

def unsafeParseSvgStringIntoNodeArray(dangerousSvgString: String): Array[Node]

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

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

Attributes