Module vocabulary

Module vocabulary 

Source
Expand description

What HTML is: the element, attribute and event names ui: will write.

§Why this is a table and not a check

ui: turned any name=value into an attribute and any on_x= into data-b-x, knowing nothing about either. A misspelling was not a compile error, not a lint and not visible in a snapshot review — span(on_mouseenter=…) shipped a dead attribute to a browser that listens for five events and passed every gate, and cls="done" — the spelling docs/01 §1.3’s own sketch uses — silently lost a page its styling. docs/104 §104.8’s Wall 2 is the measurement.

It lives here, as data, rather than in the ui module’s expander, for a scheduling reason: ui: is a compiler-provided special case standing in for a user-written macro, and typed macros retire it (docs/10 D22). A vocabulary buried in today’s expander would be written a second time when that happens, and the second copy is the one that would drift. docs/12 §12.4’s three accessibility checks — alt text, accessible name, input label — are scheduled over this same tree and read ELEMENTS rather than a list of their own.

§What is checked, and what is not

Events are closed. EVENTS is exactly what beck-rt/client/beck-patch.js interprets, and ui.rs’s the_event_vocabulary_is_what_the_client_listens_for reads the client’s source to say so. An event the client does not handle is a data-b-* attribute wired to nothing, so there is no such thing as a custom one.

Attributes are closed with two open prefixes. data- and aria- are HTML’s own escape hatches and are admitted by rule rather than by list — which is also the answer to “what if I need an attribute that is genuinely mine”: HTML already decided, and it is data-.

Elements are not refused, and the reason is a limit of today’s surface rather than a judgement: inside a ui: block, a lowercase call whose arguments are all keyword arguments is indistinguishable from an element, so refusing an unknown one would refuse a user’s own helper function called by name. ELEMENTS is therefore a table something else reads — §12.4’s checks, and whatever ui: becomes when it is a user-written typed macro, which is where a Html-returning helper stops looking like a <div>.

Enums§

Naming
How one element is given a name a screen reader can announce.

Constants§

ALIASES
Spellings that are not typos, and what each one means here.
ATTRIBUTES
Every attribute name this vocabulary knows, beyond the data- and aria- prefixes.
ELEMENTS
Every element name this vocabulary knows: HTML’s, and the SVG subset a chart is drawn with.
EVENTS
The events the client interprets, and what each one is.
EVENT_ALIASES
Spellings of an event that are not typos either.
LABELLING
The attributes that give an element an accessible name, in the order a fix-it should offer them.
NAMING
What an element needs before somebody who cannot see it can use it.

Functions§

event_suggestion
What an event name that does not exist most likely meant, or nothing.
is_attribute
Whether name is an attribute an element may be given.
is_element
Whether name is an element this vocabulary knows.
is_event
Whether name is an event on_ may carry.
naming
What this element needs, if it is one of the ones that need anything.
nearest
The known name closest to typo, when one is close enough to be worth suggesting.
suggestion
What an attribute name that does not exist most likely meant.