aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/virtualmethods.rs
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2017-01-06 16:16:48 +0100
committerAnthony Ramine <n.oxyde@gmail.com>2017-01-07 19:21:02 +0100
commit0cb09468a0e39b7797f3cd540b8d47e0e1ba55a0 (patch)
tree067ea6e8a813b272a41124c016850021d2663e59 /components/script/dom/virtualmethods.rs
parent8caa56454002a66c7c73e7144da20731725b8edf (diff)
downloadservo-0cb09468a0e39b7797f3cd540b8d47e0e1ba55a0.tar.gz
servo-0cb09468a0e39b7797f3cd540b8d47e0e1ba55a0.zip
Properly insert text in document when parsing
If the last child of a node is a Text child and we are inserting text in that node, we need to append it to that Text child. Doing that means that HTMLStyleElement::children_changed gets called less frequently, but that's not a problem during parsing thanks to the pop hook.
Diffstat (limited to 'components/script/dom/virtualmethods.rs')
-rw-r--r--components/script/dom/virtualmethods.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/components/script/dom/virtualmethods.rs b/components/script/dom/virtualmethods.rs
index e10e48e8ab8..d6b77b31256 100644
--- a/components/script/dom/virtualmethods.rs
+++ b/components/script/dom/virtualmethods.rs
@@ -124,6 +124,14 @@ pub trait VirtualMethods {
s.cloning_steps(copy, maybe_doc, clone_children);
}
}
+
+ /// Called on an element when it is popped off the stack of open elements
+ /// of a parser.
+ fn pop(&self) {
+ if let Some(ref s) = self.super_type() {
+ s.pop();
+ }
+ }
}
/// Obtain a VirtualMethods instance for a given Node-derived object. Any