Skip to content

Node

Unofficial

Augments the built-in Node interface.

Signature:

export interface Node

Properties

Property Type Description
constructorWin Window Global window object.
doc Document The document this node belongs to, or the global document.
win Window The window object this node belongs to, or the global window.

Methods

Method Returns Description
appendText(val) void Appends a text node to the node.
createDiv(o?, callback?) HTMLDivElement Creates a new <div> element.
createEl(tag, o?, callback?) HTMLElementTagNameMap[K] Create an element and append it to this node.
createSpan(o?, callback?) HTMLSpanElement Creates a new <span> element.
createSvg(tag, o?, callback?) SVGElementTagNameMap[K] Creates a new svg element such as <svg>, <circle>, <rect>, etc.
detach() void Detaches the node from the DOM.
empty() void Empties the node.
indexOf(other) number Returns the index of the node or -1 if the node is not found.
insertAfter(node, child) T Inserts a child node after the current node.
instanceOf(type) this is T Cross-window capable instanceof check, a drop-in replacement for instanceof checks on DOM Nodes. Remember to also check for nulls when necessary.
setChildrenInPlace(children) void Sets the children of the node.

Links to this page: