aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/element.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/element.rs')
-rw-r--r--components/script/dom/element.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs
index c384001e33a..6df2122e7b3 100644
--- a/components/script/dom/element.rs
+++ b/components/script/dom/element.rs
@@ -2151,10 +2151,12 @@ impl VirtualMethods for Element {
return;
}
+ let doc = document_from_node(self);
if let Some(ref value) = *self.id_attribute.borrow() {
- let doc = document_from_node(self);
doc.register_named_element(self, value.clone());
}
+ // This is used for layout optimization.
+ doc.increment_dom_count();
}
fn unbind_from_tree(&self, context: &UnbindContext) {
@@ -2164,10 +2166,12 @@ impl VirtualMethods for Element {
return;
}
+ let doc = document_from_node(self);
if let Some(ref value) = *self.id_attribute.borrow() {
- let doc = document_from_node(self);
doc.unregister_named_element(self, value.clone());
}
+ // This is used for layout optimization.
+ doc.decrement_dom_count();
}
fn children_changed(&self, mutation: &ChildrenMutation) {