Expand description
Resolving the {...} placeholders a template carries.
A <for> body and a fragment body are written with placeholders standing
in for what the iteration or the instantiation brings: {row.name},
{$index}, {$theme}. Turning a template into an instance means walking
the subtree and replacing each of them with the value its scope holds.
This lives here, below both consumers, because the desktop reconciler and the web emitter write the same text into the same node a tick apart. Two resolvers would drift, and a drift shows up as a page the browser rebuilds on load rather than adopts.
A placeholder whose scope is absent is left in the string verbatim, so the
walk that owns that scope resolves it later: a fragment walk resolves its
arguments and leaves {row.name} standing for the <for> walk inside it.
Structs§
- Row
- One iteration of a
<for>body: the record its placeholders read and the index they count from. - Scope
- The scopes a placeholder can resolve against.
Traits§
- Globals
- Where a global placeholder reads its value.
Functions§
- carries_
placeholder - Whether any string
substitute_attrsresolves carries a{. - element_
carries_ placeholder - Whether anything a substitution resolves on
elementcarries a{: its own strings, and the arguments a use site passes. - resolve
- Replace every
{...}token intextwith what its scope holds. - substitute_
attrs - The attributes to build an element with, once the placeholders in its own
strings are resolved against
scope. - substitute_
element - Walk a template subtree, resolving every placeholder in its string-valued
attributes and its text against
scope.