This replaces the dom::Element type with a generic trait Anchor implemented for types:
Node: regular DOM node
dom::Fragment: transparent wrapper around Node referencing a document fragment.
dom::DynAnchor: transparent wrapper around JsValue that may or may not be referencing a document fragment.
In addition the Mountable trait has provided unmount and replace_with methods that should always be used directly instead of calling mountable.anchor().unmount() or mountable.anchor().replace_with(new).
This removes a lot of branching when unmounting and replacing elements in the DOM, which once again produces smaller Wasm binaries and should improve runtime performance.
This replaces the
dom::Element
type with a generic traitAnchor
implemented for types:Node
: regular DOM nodedom::Fragment
: transparent wrapper aroundNode
referencing a document fragment.dom::DynAnchor
: transparent wrapper aroundJsValue
that may or may not be referencing a document fragment.In addition the
Mountable
trait has providedunmount
andreplace_with
methods that should always be used directly instead of callingmountable.anchor().unmount()
ormountable.anchor().replace_with(new)
.This removes a lot of branching when unmounting and replacing elements in the DOM, which once again produces smaller Wasm binaries and should improve runtime performance.