function / @typed/template/Wire

getElements

Extracts all Elements from a Rendered value.

Package version
1.0.0-beta.7
Category
Rendered element traversal
Since
1.0.0

Import

import { getElements } from "@typed/template/Wire";

Signatures

export declare function getElements(node: Rendered): Array<Element>;

Why

Delegated native events attach to the concrete element roots represented by arrays, fragments, and Wires.

Ownership and lifetime

The returned array borrows exact Element objects; it does not clone or own them.

Examples

import { getElements } from "@typed/template/Wire"

const div = document.createElement("div")
const span = document.createElement("span")
const fragment = document.createDocumentFragment()
fragment.appendChild(div)
fragment.appendChild(span)

const elements = getElements(fragment)
console.log(elements.length) // 2

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source