Skip to content

Commit

Permalink
servo: Merge #16010 - Properly coalesce whitespace when given a refer…
Browse files Browse the repository at this point in the history
…ence child (fixes #15979) (from nox:h5e); r=KiChjang

Source-Repo: https://github.com/servo/servo
Source-Revision: 32784c5fa8f30f007a45122dae5ae16d06d1733d

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : ddf9716a214137691d0bd6ef8d1ca080f8dc5644
  • Loading branch information
nox committed Mar 17, 2017
1 parent 6312945 commit a11d67e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion servo/components/script/dom/servoparser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,12 @@ fn insert(parent: &Node, reference_child: Option<&Node>, child: NodeOrText<JS<No
parent.InsertBefore(&n, reference_child).unwrap();
},
NodeOrText::AppendText(t) => {
if let Some(text) = parent.GetLastChild().and_then(Root::downcast::<Text>) {
let text = reference_child
.and_then(Node::GetPreviousSibling)
.or_else(|| parent.GetLastChild())
.and_then(Root::downcast::<Text>);

if let Some(text) = text {
text.upcast::<CharacterData>().append_data(&t);
} else {
let text = Text::new(String::from(t).into(), &parent.owner_doc());
Expand Down

0 comments on commit a11d67e

Please sign in to comment.