Skip to main content

Crate layout_dom_api

Crate layout_dom_api 

Source
Expand description

Profile-neutral DOM trait.

LayoutDom is the ID-first surface that serval-layout (and other read-only DOM walkers — reader-mode, serialization, querySelector helpers) consume. It does not commit to a backing store: serval-static-dom’s StaticDocument and a future scripted-DOM provider both implement it.

Design rationale and prior art: see docs/2026-05-16_layout_dom_api_design.md.

Structs§

AttributeView
Borrowed view of one attribute on an element.
QualName
A fully qualified name (with a namespace), used to depict names of tags and attributes.

Enums§

Descent
Per-node descent decision returned from NodeVisitor::enter.
DomMutation
A recorded structural DOM mutation — render-state-free (no dirty bits, no style). Id is the implementor’s LayoutDom::NodeId.
NodeKind
Plain node kind. Use the typed accessors on LayoutDom (element_name, attribute, text, etc.) to read kind-specific data.
QuirksMode
A document’s quirks mode, for compatibility with old browsers. See quirks mode on wikipedia for more information.

Traits§

LayoutDom
Profile-neutral DOM. Implementors expose opaque NodeIds and a small set of lookup primitives; traversal happens through the default walk impl over a NodeVisitor, or through caller-driven cursors built on the lookup primitives.
LayoutDomMut
Mutation extension for scripted DOMs (plan Part 3 / the layout_dom_api design’s open question #1). Read-only consumers (reader-mode, serialization, static layout) implement only LayoutDom; serval-scripted-dom implements both.
NodeVisitor
Visitor over a LayoutDom. Methods return ControlFlow so the visitor can bail early with a typed Stop value. Use type Stop = () for plain “stop or not”; use core::convert::Infallible to assert the walk never terminates early; use a typed error type to carry per-node-failure data out of the walk.

Functions§

walk_subtree
Walk root’s subtree with visitor, descending via LayoutDom::dom_children. Returns ControlFlow::Break(stop) if any visitor method bailed; otherwise ControlFlow::Continue(()).

Type Aliases§

LocalName
Namespace