pub trait VirtualMethods {
    fn super_type(&self) -> Option<&dyn VirtualMethods>;

    fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation<'_>) { ... }
    fn attribute_affects_presentational_hints(&self, attr: &Attr) -> bool { ... }
    fn parse_plain_attribute(
        &self,
        name: &LocalName,
        value: DOMString
    ) -> AttrValue { ... } fn bind_to_tree(&self, context: &BindContext) { ... } fn unbind_from_tree(&self, context: &UnbindContext<'_>) { ... } fn children_changed(&self, mutation: &ChildrenMutation<'_>) { ... } fn handle_event(&self, event: &Event) { ... } fn adopting_steps(&self, old_doc: &Document) { ... } fn cloning_steps(
        &self,
        copy: &Node,
        maybe_doc: Option<&Document>,
        clone_children: CloneChildrenFlag
    ) { ... } fn pop(&self) { ... } }
Expand description

Trait to allow DOM nodes to opt-in to overriding (or adding to) common behaviours. Replicates the effect of C++ virtual methods.

Required Methods

Returns self as the superclass of the implementation for this trait, if any.

Provided Methods

Returns true if given attribute attr affects style of the given element.

Returns the right AttrValue variant for the attribute with name name on this element.

Called when a Node is appended to a tree, where ‘tree_connected’ indicates whether the tree is part of a Document.

Called when a Node is removed from a tree, where ‘tree_connected’ indicates whether the tree is part of a Document. Implements removing steps: https://dom.spec.whatwg.org/#concept-node-remove-ext

Called on the parent when its children are changed.

Called during event dispatch after the bubbling phase completes.

Called on an element when it is popped off the stack of open elements of a parser.

Implementors