Bug 1472630 [wpt PR 11750] - Add a test for getRootNode({composed:true}), a=testonly
authorkaixinjxq <xiuqix.jiang@intel.com>
Mon, 13 Aug 2018 18:22:10 +0000
changeset 431512 4b5dc6900b75c33a8b5ca9f7efd8ee91f5fa285e
parent 431511 c47fca0f6839156e8039bbff8d3381e7128dc86a
child 431513 fa822c31ed77e4baa99433b6c87c017aeb4a65d7
push id34443
push usercsabou@mozilla.com
push dateWed, 15 Aug 2018 00:53:32 +0000
treeherdermozilla-central@b80906e2fbc9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1472630, 11750
milestone63.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 1472630 [wpt PR 11750] - Add a test for getRootNode({composed:true}), a=testonly Automatic update from web-platform-testsDOM: add a test for getRootNode({composed:true}) Fixes #3712. -- wpt-commits: 315ad5300562f570b3fdffcfc8041dbd5024b592 wpt-pr: 11750
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/dom/nodes/rootNode.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -580233,17 +580233,17 @@
    "7eb1baf15f05f95545a563fe216eac0655c38a74",
    "support"
   ],
   "dom/nodes/remove-unscopable.html": [
    "0238b0fa97a40dd9e5058d4153d1483553552033",
    "testharness"
   ],
   "dom/nodes/rootNode.html": [
-   "66343e7e272740b40102fa29dd8bde7ae00bea22",
+   "784831da0ef97c9b35de1b305e5b4b0ab346cb3f",
    "testharness"
   ],
   "dom/nodes/selectors.js": [
    "587779b7da0e35f63ad94309f5e9b173adcf1cee",
    "support"
   ],
   "dom/ranges/Range-attributes.html": [
    "ced47edc5071e80372fc164b55633d8a7aa25ab4",
--- a/testing/web-platform/tests/dom/nodes/rootNode.html
+++ b/testing/web-platform/tests/dom/nodes/rootNode.html
@@ -6,16 +6,30 @@
 <link rel="help" href="https://dom.spec.whatwg.org/#dom-node-getrootnode">
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 </head>
 <body>
 <script>
 
 test(function () {
+    var shadowHost = document.createElement('div');
+    document.body.appendChild(shadowHost);
+
+    var shadowRoot = shadowHost.attachShadow({mode: 'open'});
+    shadowRoot.innerHTML = '<div class="shadowChild">content</div>';
+
+    var shadowChild = shadowRoot.querySelector('.shadowChild');
+    assert_equals(shadowChild.getRootNode({composed: true}), document, "getRootNode() must return context object's shadow-including root if options's composed is true");
+    assert_equals(shadowChild.getRootNode({composed: false}), shadowRoot, "getRootNode() must return context object's root if options's composed is false");
+    assert_equals(shadowChild.getRootNode(), shadowRoot, "getRootNode() must return context object's root if options's composed is default false");
+
+}, "getRootNode() must return context object's shadow-including root if options's composed is true, and context object's root otherwise");
+
+test(function () {
     var element = document.createElement('div');
     assert_equals(element.getRootNode(), element, 'getRootNode() on an element without a parent must return the element itself');
 
     var text = document.createTextNode('');
     assert_equals(text.getRootNode(), text, 'getRootNode() on a text node without a parent must return the text node itself');
 
     var processingInstruction = document.createProcessingInstruction('target', 'data');
     assert_equals(processingInstruction.getRootNode(), processingInstruction, 'getRootNode() on a processing instruction node without a parent must return the processing instruction node itself');