Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / imported / web-platform-tests / shadow-dom / shadow-trees / upper-boundary-encapsulation / shadow-root-001.html
1 <!DOCTYPE html>
2 <!-- 
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].
6
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
10  -->
11 <html>
12 <head>
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">
23 </head>
24 <body>
25 <div id="log"></div>
26 <script>
27 test(function () {
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.');
32
33 test(function () {
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.');
38
39 test(function () {
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);
46 },
47     'The parentNode attribute of a shadow root must always return null, ' +
48     'even if the shadow root is nested inside another shadow root.'
49 );
50
51 test(function () {
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);
58 },
59     'The parentElement attribute of a shadow root must always return null, ' +
60     'even if the shadow root is nested inside another shadow root.'
61 );
62 </script>
63 </body>
64 </html>