Skip to content

Commit

Permalink
Call children_changed on the parent node consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
CYBAI committed Nov 27, 2017
1 parent ac6e04e commit 3a74014
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions components/script/dom/characterdata.rs
Expand Up @@ -70,6 +70,16 @@ impl CharacterData {
fn content_changed(&self) {
let node = self.upcast::<Node>();
node.dirty(NodeDamage::OtherNodeDamage);

// If this is a Text node, we might need to re-parse (say, if our parent
// is a <style> element.) We don't need to if this is a Comment or
// ProcessingInstruction.
if self.is::<Text>() {
if let Some(parent_node) = node.GetParentNode() {
let mutation = ChildrenMutation::ChangeText;
vtable_for(&parent_node).children_changed(&mutation);
}
}
}
}

Expand All @@ -87,16 +97,6 @@ impl CharacterDataMethods for CharacterData {
self.content_changed();
let node = self.upcast::<Node>();
node.ranges().replace_code_units(node, 0, old_length, new_length);

// If this is a Text node, we might need to re-parse (say, if our parent
// is a <style> element.) We don't need to if this is a Comment or
// ProcessingInstruction.
if self.is::<Text>() {
if let Some(parent_node) = node.GetParentNode() {
let mutation = ChildrenMutation::ChangeText;
vtable_for(&parent_node).children_changed(&mutation);
}
}
}

// https://dom.spec.whatwg.org/#dom-characterdata-length
Expand Down

0 comments on commit 3a74014

Please sign in to comment.