Bug 1447248 [wpt PR 10107] - Make Range::intersectsNode() to follow the spec, a=testonly
authorYoshifumi Inoue <yosin@chromium.org>
Mon, 09 Apr 2018 17:36:45 +0000
changeset 467152 e86c0b63db6224e0dee57d54591ee75c6f2b8a15
parent 467151 08a3796277e9b6407c125eaaa66faa585d735708
child 467153 f2cb9ba956877b2b03bc4aa85a5c940948c2ee2d
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1447248, 10107, 822510, 970044, 544971
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1447248 [wpt PR 10107] - Make Range::intersectsNode() to follow the spec, a=testonly Automatic update from web-platform-testsMake Range::intersectsNode() to follow the spec This patch change |Range::intersectsNode()| to follow the spec[1]. [1] https://dom.spec.whatwg.org/#dom-range-intersectsnode Bug: 822510 Change-Id: Ifd504443355da12482b759701cddd62e2a90d7a6 Reviewed-on: https://chromium-review.googlesource.com/970044 Reviewed-by: Kent Tamura <tkent@chromium.org> Commit-Queue: Yoshifumi Inoue <yosin@chromium.org> Cr-Commit-Position: refs/heads/master@{#544971} wpt-commits: 14f1aecaee987281fd960ba0818c49dbd11f20fe wpt-pr: 10107 wpt-commits: 14f1aecaee987281fd960ba0818c49dbd11f20fe wpt-pr: 10107
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/dom/ranges/Range-intersectsNode-2.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -322001,16 +322001,22 @@
    "dom/ranges/Range-insertNode.html": [
     [
      "/dom/ranges/Range-insertNode.html",
      {
       "timeout": "long"
      }
     ]
    ],
+   "dom/ranges/Range-intersectsNode-2.html": [
+    [
+     "/dom/ranges/Range-intersectsNode-2.html",
+     {}
+    ]
+   ],
    "dom/ranges/Range-intersectsNode-binding.html": [
     [
      "/dom/ranges/Range-intersectsNode-binding.html",
      {
       "timeout": "long"
      }
     ]
    ],
@@ -547208,16 +547214,20 @@
   "dom/ranges/Range-extractContents.html": [
    "07de13c57ec16440d655a2fb22040e9949ebeb73",
    "testharness"
   ],
   "dom/ranges/Range-insertNode.html": [
    "c6c16aeceb585d7587e7447964112786f87700cd",
    "testharness"
   ],
+  "dom/ranges/Range-intersectsNode-2.html": [
+   "9b613f401c6ef6bc9ef70fc43a83df4130d9149c",
+   "testharness"
+  ],
   "dom/ranges/Range-intersectsNode-binding.html": [
    "93ac9f3cc9b506760b685b074cb0f66ea69bebb7",
    "testharness"
   ],
   "dom/ranges/Range-intersectsNode.html": [
    "3225ef68705eae59016cfc8b4117cb35c30f2eb4",
    "testharness"
   ],
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/dom/ranges/Range-intersectsNode-2.html
@@ -0,0 +1,36 @@
+<!doctype htlml>
+<title>Range.intersectsNode</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="div"><span id="s0">s0</span><span id="s1">s1</span><span id="s2">s2</span></div>
+<script>
+// Taken from Chromium bug: http://crbug.com/822510
+test(() => {
+  const range = new Range();
+  const div = document.getElementById('div');
+  const s0 = document.getElementById('s0');
+  const s1 = document.getElementById('s1');
+  const s2 = document.getElementById('s2');
+
+  // Range encloses s0
+  range.setStart(div, 0);
+  range.setEnd(div, 1);
+  assert_true(range.intersectsNode(s0), '[s0] range.intersectsNode(s0)');
+  assert_false(range.intersectsNode(s1), '[s0] range.intersectsNode(s1)');
+  assert_false(range.intersectsNode(s2), '[s0] range.intersectsNode(s2)');
+
+  // Range encloses s1
+  range.setStart(div, 1);
+  range.setEnd(div, 2);
+  assert_false(range.intersectsNode(s0), '[s1] range.intersectsNode(s0)');
+  assert_true(range.intersectsNode(s1), '[s1] range.intersectsNode(s1)');
+  assert_false(range.intersectsNode(s2), '[s1] range.intersectsNode(s2)');
+
+  // Range encloses s2
+  range.setStart(div, 2);
+  range.setEnd(div, 3);
+  assert_false(range.intersectsNode(s0), '[s2] range.intersectsNode(s0)');
+  assert_false(range.intersectsNode(s1), '[s2] range.intersectsNode(s1)');
+  assert_true(range.intersectsNode(s2), '[s2] range.intersectsNode(s2)');
+}, 'Range.intersectsNode() simple cases');
+</script>