diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2016-02-29 00:19:18 +0100 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2016-02-29 00:19:18 +0100 |
commit | c0d79062b5bb34ee3c28e7c591c2b22d361830b9 (patch) | |
tree | efbdeeb4ad497185012739112b5f6ea498af849f /components/script/dom/range.rs | |
parent | be6940db59a2e8bf4fac45911848edbc8cd3dd8d (diff) | |
download | servo-c0d79062b5bb34ee3c28e7c591c2b22d361830b9.tar.gz servo-c0d79062b5bb34ee3c28e7c591c2b22d361830b9.zip |
Fix step 14.2 of Range::ExtractContents
We need the last inclusive ancestor of start node that is not an inclusive ancestor
of end node, not the first that is an inclusive ancestor of it.
Diffstat (limited to 'components/script/dom/range.rs')
-rw-r--r-- | components/script/dom/range.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/components/script/dom/range.rs b/components/script/dom/range.rs index 88fc9ad35bc..c6efae90b98 100644 --- a/components/script/dom/range.rs +++ b/components/script/dom/range.rs @@ -564,8 +564,9 @@ impl RangeMethods for Range { } else { // Step 14.1-2. let reference_node = start_node.ancestors() - .find(|n| n.is_inclusive_ancestor_of(end_node.r())) - .unwrap(); + .take_while(|n| !n.is_inclusive_ancestor_of(&end_node)) + .last() + .unwrap_or(Root::from_ref(&start_node)); // Step 14.3. (reference_node.GetParentNode().unwrap(), reference_node.index() + 1) }; |