Fix: diffing should poproots too
This commit is contained in:
1 parent
09d193d999
commit
93405c2a40
3 files changed
+10
No files matched your search
@@ -426,6 +426,7 @@ impl<'b> DiffState<'b> {
|
|||||||
self.mutations.push_root(root);
|
self.mutations.push_root(root);
|
||||||
let created = self.create_children(new.children);
|
let created = self.create_children(new.children);
|
||||||
self.mutations.append_children(created as u32);
|
self.mutations.append_children(created as u32);
|
||||||
|
self.mutations.pop_root();
|
||||||
}
|
}
|
||||||
(_, _) => self.diff_children(old.children, new.children),
|
(_, _) => self.diff_children(old.children, new.children),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -185,6 +185,9 @@ pub enum DomEdit<'bump> {
|
|||||||
/// The namespace of the attribute.
|
/// The namespace of the attribute.
|
||||||
ns: Option<&'bump str>,
|
ns: Option<&'bump str>,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/// Manually pop a root node from the stack.
|
||||||
|
PopRoot {},
|
||||||
}
|
}
|
||||||
|
|
||||||
use fxhash::FxHashSet;
|
use fxhash::FxHashSet;
|
||||||
@@ -205,6 +208,11 @@ impl<'a> Mutations<'a> {
|
|||||||
self.edits.push(PushRoot { root: id });
|
self.edits.push(PushRoot { root: id });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Navigation
|
||||||
|
pub(crate) fn pop_root(&mut self) {
|
||||||
|
self.edits.push(PopRoot {});
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) fn replace_with(&mut self, root: ElementId, m: u32) {
|
pub(crate) fn replace_with(&mut self, root: ElementId, m: u32) {
|
||||||
let root = root.as_u64();
|
let root = root.as_u64();
|
||||||
self.edits.push(ReplaceWith { m, root });
|
self.edits.push(ReplaceWith { m, root });
|
||||||
|
|||||||
@@ -752,6 +752,7 @@ fn add_nested_elements() {
|
|||||||
PushRoot { root: 1 },
|
PushRoot { root: 1 },
|
||||||
CreateElement { root: 2, tag: "div" },
|
CreateElement { root: 2, tag: "div" },
|
||||||
AppendChildren { many: 1 },
|
AppendChildren { many: 1 },
|
||||||
|
PopRoot {},
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user