diff options
-rw-r--r-- | components/script/dom/range.rs | 5 | ||||
-rw-r--r-- | tests/wpt/metadata/dom/ranges/Range-extractContents.html.ini | 17 |
2 files changed, 3 insertions, 19 deletions
diff --git a/components/script/dom/range.rs b/components/script/dom/range.rs index 7044746ddf1..235a4dbcc9b 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) }; diff --git a/tests/wpt/metadata/dom/ranges/Range-extractContents.html.ini b/tests/wpt/metadata/dom/ranges/Range-extractContents.html.ini deleted file mode 100644 index e509efc61c4..00000000000 --- a/tests/wpt/metadata/dom/ranges/Range-extractContents.html.ini +++ /dev/null @@ -1,17 +0,0 @@ -[Range-extractContents.html] - type: testharness - [Resulting cursor position for range 18 [paras[0\].firstChild, 0, paras[1\].firstChild, 0\]] - expected: FAIL - - [Resulting cursor position for range 19 [paras[0\].firstChild, 0, paras[1\].firstChild, 8\]] - expected: FAIL - - [Resulting cursor position for range 20 [paras[0\].firstChild, 3, paras[3\], 1\]] - expected: FAIL - - [Resulting cursor position for range 50 [paras[2\].firstChild, 4, comment, 2\]] - expected: FAIL - - [Resulting cursor position for range 51 [paras[3\], 1, comment, 8\]] - expected: FAIL - |