aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/node.rs
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2015-07-24 15:38:05 +0200
committerAnthony Ramine <n.oxyde@gmail.com>2015-08-09 00:10:21 +0200
commit4e8922a53a7dcd40aba45e11a25dd614d8330e07 (patch)
treee3f68a9154bcefb75e56f1451444d7b856a7d76e /components/script/dom/node.rs
parenta49eb14615b12960b0bb35cc2b5c59e46f47d869 (diff)
downloadservo-4e8922a53a7dcd40aba45e11a25dd614d8330e07.tar.gz
servo-4e8922a53a7dcd40aba45e11a25dd614d8330e07.zip
Optimise Node.childNodes
We use the virtual method children_changed() to propagate changes in the children list to the NodeList tied to Node.childNodes.
Diffstat (limited to 'components/script/dom/node.rs')
-rw-r--r--components/script/dom/node.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index e8cb5641e29..09aadc71be9 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -40,7 +40,7 @@ use dom::element::{AttributeHandlers, Element, ElementCreator, ElementTypeId};
use dom::element::ElementHelpers;
use dom::eventtarget::{EventTarget, EventTargetTypeId};
use dom::htmlelement::HTMLElementTypeId;
-use dom::nodelist::NodeList;
+use dom::nodelist::{NodeList, NodeListHelpers};
use dom::processinginstruction::{ProcessingInstruction, ProcessingInstructionHelpers};
use dom::text::Text;
use dom::virtualmethods::{VirtualMethods, vtable_for};
@@ -2582,6 +2582,9 @@ impl<'a> VirtualMethods for &'a Node {
self.children_count.set(added.len() as u32);
},
}
+ if let Some(list) = self.child_list.get().map(|list| list.root()) {
+ list.as_children_list().children_changed(mutation);
+ }
}
}