[−][src]Trait yew::virtual_dom::VDiff
This trait provides features to update a tree by calculating a difference against another tree.
Required methods
fn detach(&mut self, parent: &Element) -> Option<Node>
Remove itself from parent and return the next sibling.
fn apply(
&mut self,
parent: &Element,
previous_sibling: Option<&Node>,
ancestor: Option<VNode>
) -> Option<Node>
&mut self,
parent: &Element,
previous_sibling: Option<&Node>,
ancestor: Option<VNode>
) -> Option<Node>
Scoped diff apply to other tree.
Virtual rendering for the node. It uses parent node and existing children (virtual and DOM) to check the difference and apply patches to the actual DOM representation.
Parameters:
parent
: the parent node in the DOM.previous_sibling
: the "previous node" in a list of nodes, used to efficiently find where to put the node.ancestor
: the node that this node will be replacing in the DOM. This method will always remove theancestor
from theparent
.parent_scope
: the parentScope
used for passing messages to the parentComponent
.
Internal Behavior Notice:
Note that these modify the DOM by modifying the reference that already exists
on the ancestor
. If self.reference
exists (which it shouldn't) this method
will panic.
The exception to this is obviously VRef
which simply uses the inner Node
directly
(always removes the Node
that exists).
Implementors
impl VDiff for VNode
[src]
fn detach(&mut self, parent: &Element) -> Option<Node>
[src]
Remove VNode from parent.
fn apply(
&mut self,
parent: &Element,
previous_sibling: Option<&Node>,
ancestor: Option<VNode>
) -> Option<Node>
[src]
&mut self,
parent: &Element,
previous_sibling: Option<&Node>,
ancestor: Option<VNode>
) -> Option<Node>
impl VDiff for VComp
[src]
fn detach(&mut self, parent: &Element) -> Option<Node>
[src]
fn apply(
&mut self,
parent: &Element,
previous_sibling: Option<&Node>,
ancestor: Option<VNode>
) -> Option<Node>
[src]
&mut self,
parent: &Element,
previous_sibling: Option<&Node>,
ancestor: Option<VNode>
) -> Option<Node>
impl VDiff for VList
[src]
fn detach(&mut self, parent: &Element) -> Option<Node>
[src]
fn apply(
&mut self,
parent: &Element,
previous_sibling: Option<&Node>,
ancestor: Option<VNode>
) -> Option<Node>
[src]
&mut self,
parent: &Element,
previous_sibling: Option<&Node>,
ancestor: Option<VNode>
) -> Option<Node>
impl VDiff for VTag
[src]
fn detach(&mut self, parent: &Element) -> Option<Node>
[src]
Remove VTag from parent.
fn apply(
&mut self,
parent: &Element,
previous_sibling: Option<&Node>,
ancestor: Option<VNode>
) -> Option<Node>
[src]
&mut self,
parent: &Element,
previous_sibling: Option<&Node>,
ancestor: Option<VNode>
) -> Option<Node>
Renders virtual tag over DOM Element
, but it also compares this with an ancestor VTag
to compute what to patch in the actual DOM nodes.