Skip to content

Node

Unofficial

Augments the built-in Node interface.

Signature:

export interface Node

Properties

PropertyTypeDescription
constructorWinWindowGlobal window object.
docDocumentThe document this node belongs to, or the global document.
winWindowThe window object this node belongs to, or the global window.

Methods

MethodReturnsDescription
appendText(val)voidAppends a text node to the node.
createDiv(o?, callback?)HTMLDivElementCreates a new <div> element.
createEl(tag, o?, callback?)HTMLElementTagNameMap[K]Create an element and append it to this node.
createSpan(o?, callback?)HTMLSpanElementCreates a new <span> element.
createSvg(tag, o?, callback?)SVGElementTagNameMap[K]Creates a new svg element such as <svg>, <circle>, <rect>, etc.
detach()voidDetaches the node from the DOM.
empty()voidEmpties the node.
indexOf(other)numberReturns the index of the node or -1 if the node is not found.
insertAfter(node, child)TInserts a child node after the current node.
instanceOf(type)this is TCross-window capable instanceof check, a drop-in replacement for instanceof checks on DOM Nodes. Remember to also check for nulls when necessary.
setChildrenInPlace(children)voidSets the children of the node.

Links to this page: