kit
Functions
Section titled “Functions”boolAttr()
Section titled “boolAttr()”function boolAttr(el, name): boolean;HTML boolean attribute: present = true.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
el |
ElementNode |
name |
string |
Returns
Section titled “Returns”boolean
children()
Section titled “children()”function children(el, tag): ElementNode[];Element children with the given tag, in order.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
el |
ElementNode |
tag |
string |
Returns
Section titled “Returns”descendants()
Section titled “descendants()”function descendants(el, tag): ElementNode[];Elements with the given tag anywhere inside el, in document order: the inline children of a rich block.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
el |
ElementNode |
tag |
string |
Returns
Section titled “Returns”enumAttr()
Section titled “enumAttr()”function enumAttr<T>( el, name, values, fallback): T;One of values, else fallback (absent or unknown value).
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T extends string |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
el |
ElementNode |
name |
string |
values |
readonly T[] |
fallback |
T |
Returns
Section titled “Returns”T
hasPicture()
Section titled “hasPicture()”function hasPicture(el): boolean;Whether the element shows a picture (an img anywhere inside it).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
el |
ElementNode |
Returns
Section titled “Returns”boolean
intAttr()
Section titled “intAttr()”function intAttr(el, name): number | null;An integer, or null when absent or not an integer.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
el |
ElementNode |
name |
string |
Returns
Section titled “Returns”number | null
label()
Section titled “label()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
el |
ElementNode |
Returns
Section titled “Returns”string
numberAttr()
Section titled “numberAttr()”function numberAttr(el, name): number | null;A decimal number (dot separator), or null when absent or not a number.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
el |
ElementNode |
name |
string |
Returns
Section titled “Returns”number | null
publicView()
Section titled “publicView()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
el |
ElementNode |
manifest |
ComponentManifest |
ctx |
CompileContext |
Returns
Section titled “Returns”stringAttr()
Section titled “stringAttr()”function stringAttr(el, name): string | null;The attribute value, or null when absent.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
el |
ElementNode |
name |
string |
Returns
Section titled “Returns”string | null
text()
Section titled “text()”function text(el): string;Text of an element and its descendants, as written.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
el |
ElementNode |
Returns
Section titled “Returns”string
urlAttr()
Section titled “urlAttr()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
el |
ElementNode |
name |
string |
Returns
Section titled “Returns”string | null