Available on crate feature
wasm only.Expand description
WebAssembly bindings.
§Why this does not follow WINGED_RUST_SPEC.md §4.1
The spec’s WasmDocument holds body_nodes: Vec<String>: it renders each node to a
string on insertion and concatenates at the end. That throws the tree away, so
render_pretty() becomes impossible, nothing can be modified after insertion, and the
API is limited to the two element types the spec hard-codes.
These bindings wrap the real Element and Document behind opaque handles instead.
JavaScript therefore drives the same renderer as Rust does, which is what lets the
Node smoke test diff its output against the same golden fixture the Rust tests use. If
native and WASM ever diverge, that diff catches it.
Structs§
- WDocument
- A complete HTML document, usable from JavaScript.
- WElement
- An HTML element, usable from JavaScript.
- WSeo
- A page’s SEO metadata block, usable from JavaScript.
Functions§
- element
- Creates an element. The idiomatic JS entry point —
element("div")reads better thannew WElement("div"). - escape_
text - Escapes text for HTML content, exposed for callers doing their own assembly.
- version
- The crate version, so a page can report which build produced it.