Skip to content

kit

function boolAttr(el, name): boolean;

HTML boolean attribute: present = true.

Parameter Type
el ElementNode
name string

boolean


function children(el, tag): ElementNode[];

Element children with the given tag, in order.

Parameter Type
el ElementNode
tag string

ElementNode[]


function descendants(el, tag): ElementNode[];

Elements with the given tag anywhere inside el, in document order: the inline children of a rich block.

Parameter Type
el ElementNode
tag string

ElementNode[]


function enumAttr<T>(
el,
name,
values,
fallback
): T;

One of values, else fallback (absent or unknown value).

Type Parameter
T extends string
Parameter Type
el ElementNode
name string
values readonly T[]
fallback T

T


function hasPicture(el): boolean;

Whether the element shows a picture (an img anywhere inside it).

Parameter Type
el ElementNode

boolean


function intAttr(el, name): number | null;

An integer, or null when absent or not an integer.

Parameter Type
el ElementNode
name string

number | null


function label(el): string;

What an element says to a student: its text with each picture's alt in its place (screen readers read it out), whitespace runs collapsed, trimmed. Empty when there is no text and every picture is decorative (alt=""), so definitions can tell an option or a card that shows only a picture from an empty one.

Parameter Type
el ElementNode

string


function numberAttr(el, name): number | null;

A decimal number (dot separator), or null when absent or not a number.

Parameter Type
el ElementNode
name string

number | null


function publicView(
el,
manifest,
ctx
): ElementNode;

The generic public view of an element: id (opaque) and v (manifest version) first, then the public attributes as written plus lang and dir; private attributes and private children are dropped; public children keep their public attributes (local id-typed values become opaque ids) and their sanitised content. A rich block (content: 'flow') keeps its content, with the same rules for the children in it. Definitions add derived attributes or reorder children on top of it.

Parameter Type
el ElementNode
manifest ComponentManifest
ctx CompileContext

ElementNode


function stringAttr(el, name): string | null;

The attribute value, or null when absent.

Parameter Type
el ElementNode
name string

string | null


function text(el): string;

Text of an element and its descendants, as written.

Parameter Type
el ElementNode

string


function urlAttr(el, name): string | null;

A url attribute, or null when absent or blank. The sanitiser has already passed it through the engine's URL policy, so a blocked URL never reaches a definition.

Parameter Type
el ElementNode
name string

string | null