DOMNode
Defined in: src/dom/dom.ts:6
Base tree node: parent/children links and identity. Widget extends it with layout, styling, and rendering. Bindings build a tree of these and the engine walks it each frame.
Extended by
Section titled “Extended by”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new DOMNode(
tagName?):DOMNode
Defined in: src/dom/dom.ts:18
Parameters
Section titled “Parameters”tagName?
Section titled “tagName?”string = ""
Returns
Section titled “Returns”DOMNode
Properties
Section titled “Properties”children
Section titled “children”children:
DOMNode[] =[]
Defined in: src/dom/dom.ts:16
Child nodes in document order.
classes
Section titled “classes”classes:
Set<string>
Defined in: src/dom/dom.ts:10
Advisory class names (no CSS cascade today).
id:
string=""
Defined in: src/dom/dom.ts:8
Optional stable identifier (from the id prop).
parent
Section titled “parent”parent:
DOMNode|null=null
Defined in: src/dom/dom.ts:14
Parent node, or null when detached / at the root.
tagName
Section titled “tagName”tagName:
string=""
Defined in: src/dom/dom.ts:12
Host element tag, lowercased (e.g. “ztui-button”).
Methods
Section titled “Methods”appendChild()
Section titled “appendChild()”appendChild(
child):void
Defined in: src/dom/dom.ts:23
Append child, detaching it from any previous parent.
Parameters
Section titled “Parameters”DOMNode
Returns
Section titled “Returns”void
describe()
Section titled “describe()”describe():
string
Defined in: src/dom/dom.ts:59
Human/LLM-readable identity for logs and diagnostics, e.g.
button#submit.primary @ (2,1 10x1). Includes the laid-out region when
one is present (widgets), and the text preview for text nodes.
Returns
Section titled “Returns”string
insertBefore()
Section titled “insertBefore()”insertBefore(
child,before):void
Defined in: src/dom/dom.ts:41
Insert child before the before sibling (appends if before isn’t found).
Parameters
Section titled “Parameters”DOMNode
before
Section titled “before”DOMNode
Returns
Section titled “Returns”void
matchesSelector()
Section titled “matchesSelector()”matchesSelector(
selector):boolean
Defined in: src/dom/dom.ts:109
Match a compound selector against this node — tags, IDs, and classes (e.g. tag#id.a.b).
Parameters
Section titled “Parameters”selector
Section titled “selector”string
Returns
Section titled “Returns”boolean
removeChild()
Section titled “removeChild()”removeChild(
child):void
Defined in: src/dom/dom.ts:32
Remove child if it’s a child of this node.
Parameters
Section titled “Parameters”DOMNode
Returns
Section titled “Returns”void
walk()
Section titled “walk()”walk(
callback):void
Defined in: src/dom/dom.ts:83
Depth-first visit of this node and its descendants, in z-index (paint)
order — mirrors what’s actually drawn on top, for callers like
toAccessibleText(). z-index is a paint-only concept, so callers that
need tab/focus order (nothing to do with stacking) should use
walkDocumentOrder instead — otherwise a widget with a nonzero
z-index purely for painting (e.g. an overlapping decorative sibling)
jumps to a different position in the Tab sequence than where it
structurally sits.
Parameters
Section titled “Parameters”callback
Section titled “callback”(node) => void
Returns
Section titled “Returns”void
walkDocumentOrder()
Section titled “walkDocumentOrder()”walkDocumentOrder(
callback):void
Defined in: src/dom/dom.ts:101
Depth-first visit of this node and its descendants in plain document order, ignoring z-index. Use for tab/focus order (e.g. Screen.getFocusableWidgets) — see walk’s doc comment for why z-index order is wrong there.
Parameters
Section titled “Parameters”callback
Section titled “callback”(node) => void
Returns
Section titled “Returns”void