element

Function element 

Source
pub fn element(
    tag: &Value,
    attrs: &[Value],
    children: &[Value],
) -> Result<Html, String>
Expand description

The node html_el(tag, attrs, children) builds, out of the three values it is given.

One function, two callers. The evaluator reaches it from Prim::HtmlEl; the native heap’s decoder reaches it because a compiled view answers with the arguments rather than with a tree — a Str, a list of attributes and a list of children — and the tree is built here on the way out. What lives in this function is not the assembly but the three rules that go with it: an attribute with an empty value is dropped rather than emitted, a handler becomes data-b-<event> carrying the command as JSON, and a key sets the node’s key rather than an attribute. Each is a decision the differ downstream depends on, and a second spelling of any of them would be a compiled page that differs from an interpreted one in a way no type can catch.