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 / ownerdocument-002.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: Upper-boundary encapsuration on ownerDocument: with all HTML5 elements</title>
14 <link rel="author" title="Aleksei Yu. Semenov" href="mailto:sgrekhov@unipro.ru">
15 <link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
16 <link rel="author" title="Mikhail Fursov" href="mailto:mfursov@unipro.ru">
17 <link rel="author" title="Yuta Kitamura" href="mailto:yutak@google.com">
18 <link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#upper-boundary-encapsulation">
19 <meta name="assert" content="Upper-boundary encapsulation: The ownerDocument property of all nodes in shadow tree refers to the document of the shadow host.">
20 <script src="../../../../../resources/testharness.js"></script>
21 <script src="../../../../../resources/testharnessreport.js"></script>
22 <script src="../../testcommon.js"></script>
23 <link rel="stylesheet" href="../../../../../resources/testharness.css">
24 </head>
25 <body>
26 <div id="log"></div>
27 <script>
28 function testElement(elementName) {
29     var doc = document.implementation.createHTMLDocument('Test');
30     var element = doc.createElement(elementName);
31     doc.body.appendChild(element);
32     var shadowRoot = element.createShadowRoot();
33     HTML5_ELEMENT_NAMES.forEach(function (name) {
34         shadowRoot.appendChild(doc.createElement(name));
35     });
36
37     var iterator = doc.createNodeIterator(shadowRoot, 0xFFFFFFFF, null);
38     var node;
39     while (node = iterator.nextNode()) {
40         assert_equals(node.ownerDocument, doc);
41     }
42 }
43
44 var testParameters = HTML5_ELEMENT_NAMES.map(function (name) {
45     return [
46         'ownerDocument property of any elements in a shadow tree should ' +
47         'match the document of the shadow host, when the host is a "' +
48         name + '" element.',
49         name
50     ];
51 });
52
53 generate_tests(testElement, testParameters);
54 </script>
55 </body>
56 </html>