Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / w3c / web-platform-tests / shadow-dom / shadow-trees / content-pseudo-element / test-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: A_04_04_01</title>
14 <link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
15 <link rel="author" title="Tetsuharu OHZEKI" href="mailto:saneyuki.snyk@gmail.com">
16 <link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#distributed-pseudo-element">
17 <meta name="assert" content="Matching Children, Distributed To Insertion Points">
18 <script src="../../../../../resources/testharness.js"></script>
19 <script src="../../../../../resources/testharnessreport.js"></script>
20 <script src="../../testcommon.js"></script>
21 <link rel="stylesheet" href="../../../../../resources/testharness.css">
22 </head>
23 <body>
24 <div id="log"></div>
25 <script>
26 var A_04_04_01_T1 = async_test('A_04_04_01_T01');
27
28 A_04_04_01_T1.step(function () {
29     var iframe = document.createElement('iframe');
30     iframe.src = '../../resources/bobs_page.html';
31     document.body.appendChild(iframe);
32
33     iframe.onload = A_04_04_01_T1.step_func(function () {
34         try {
35             var d = iframe.contentDocument;
36
37             //make shadow tree
38             var ul = d.querySelector('ul.stories');
39             var s = createSR(ul);
40             var subdiv1 = d.createElement('div');
41             subdiv1.innerHTML = '<ul><content select="li"></content></ul>';
42             s.appendChild(subdiv1);
43
44             var shadowStyle = d.createElement('style');
45             shadowStyle.innerHTML = '*::content .shadow { display:none; }';
46             s.appendChild(shadowStyle);
47
48             //The order of DOM elements should be the following:
49             //li3, li6 - invisible. Other elements visible
50             var li3 = d.querySelector('#li3');
51             var li6 = d.querySelector('#li6');
52             assert_equals(window.getComputedStyle(li3).display, "none",
53               'Point 1: Elements that don\'t mach insertion point criteria participate in distribution');
54             assert_equals(window.getComputedStyle(li6).display, "none",
55               'Point 2: Elements that don\'t mach insertion point criteria participate in distribution');
56
57             var li1 = d.querySelector('#li1');
58             var li2 = d.querySelector('#li2');
59             var li4 = d.querySelector('#li4');
60             var li5 = d.querySelector('#li5');
61             assert_not_equals(window.getComputedStyle(li1).display, "none",
62               'Point 3: ::content pseudo-element should be a valid insertion point matching criteria, element should be visible');
63             assert_not_equals(window.getComputedStyle(li2).display, "none",
64               'Point 4: ::content pseudo-element should be a valid insertion point matching criteria, element should be visible');
65             assert_not_equals(window.getComputedStyle(li4).display, "none",
66               'Point 5: ::content pseudo-element should be a valid insertion point matching criteria, element should be visible');
67             assert_not_equals(window.getComputedStyle(li5).display, "none",
68               'Point 6: ::content pseudo-element should be a valid insertion point matching criteria, element should be visible');
69         } finally {
70             iframe.parentNode.removeChild(iframe);
71         }
72         A_04_04_01_T1.done();
73     });
74 });
75 </script>
76 </body>
77 </html>