3 Distributed under both the W3C Test Suite License [1] and the W3C
4 3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
5 policies and contribution forms [3].
7 [1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
8 [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
9 [3] http://www.w3.org/2004/10/27-testcases
13 <title>Shadow DOM Test: Shadow root's parentNode() and parentElement()</title>
14 <link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
15 <link rel="author" title="Mikhail Fursov" href="mailto:mfursov@unipro.ru">
16 <link rel="author" title="Yuta Kitamura" href="mailto:yutak@google.com">
17 <link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#upper-boundary-encapsulation">
18 <meta name="assert" content="Upper-boundary encapsulation: The parentNode and parentElement attributes of the shadow root object must always return null.">
19 <script src="../../../../../resources/testharness.js"></script>
20 <script src="../../../../../resources/testharnessreport.js"></script>
21 <script src="../../testcommon.js"></script>
22 <link rel="stylesheet" href="../../../../../resources/testharness.css">
28 var doc = document.implementation.createHTMLDocument('Test');
29 var shadowRoot = doc.body.createShadowRoot();
30 assert_equals(shadowRoot.parentNode, null);
31 }, 'The parentNode attribute of a shadow root must always return null.');
34 var doc = document.implementation.createHTMLDocument('Test');
35 var shadowRoot = doc.body.createShadowRoot();
36 assert_equals(shadowRoot.parentElement, null);
37 }, 'The parentElement attribute of a shadow root must always return null.');
40 var doc = document.implementation.createHTMLDocument('Test');
41 var outerShadowRoot = doc.body.createShadowRoot();
42 var div = doc.createElement('div');
43 outerShadowRoot.appendChild(div);
44 var innerShadowRoot = div.createShadowRoot();
45 assert_equals(innerShadowRoot.parentNode, null);
47 'The parentNode attribute of a shadow root must always return null, ' +
48 'even if the shadow root is nested inside another shadow root.'
52 var doc = document.implementation.createHTMLDocument('Test');
53 var outerShadowRoot = doc.body.createShadowRoot();
54 var div = doc.createElement('div');
55 outerShadowRoot.appendChild(div);
56 var innerShadowRoot = div.createShadowRoot();
57 assert_equals(innerShadowRoot.parentElement, null);
59 'The parentElement attribute of a shadow root must always return null, ' +
60 'even if the shadow root is nested inside another shadow root.'