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-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: A_04_04_01</title>
14 <link rel="author" title="Tetsuharu OHZEKI" href="mailto:saneyuki.snyk@gmail.com">
15 <link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#distributed-pseudo-element">
16 <meta name="assert" content="::content pseudo-element, Relative Selector">
17 <script src="../../../../../resources/testharness.js"></script>
18 <script src="../../../../../resources/testharnessreport.js"></script>
19 <script src="../../testcommon.js"></script>
20 <link rel="stylesheet" href="../../../../../resources/testharness.css">
21 </head>
22 <body>
23 <div id="log"></div>
24 <script>
25 var A_04_04_01_T2 = async_test('A_04_04_01_T02');
26
27 A_04_04_01_T2.step(function () {
28     var iframe = document.createElement('iframe');
29     iframe.src = '../../resources/bobs_page.html';
30     document.body.appendChild(iframe);
31
32     iframe.onload = A_04_04_01_T2.step_func(function () {
33         try {
34             var d = iframe.contentDocument;
35
36             //make shadow tree
37             var ul = d.querySelector('ul.stories');
38             var s = createSR(ul);
39             var subdiv1 = d.createElement('div');
40             subdiv1.innerHTML = '<ul><content select="li"></content></ul>';
41             s.appendChild(subdiv1);
42
43             var shadowStyle = d.createElement('style');
44             shadowStyle.innerHTML = '*::content > .shadow { display:none; }';
45             s.appendChild(shadowStyle);
46
47             //The order of DOM elements should be the following:
48             //li3, li6 - invisible. Other elements visible
49             var li3 = d.querySelector('#li3');
50             var li6 = d.querySelector('#li6');
51             assert_equals(window.getComputedStyle(li3).display, "none",
52               'Point 1: Elements that don\'t mach insertion point criteria participate in distribution');
53             assert_equals(window.getComputedStyle(li6).display, "none",
54               'Point 2: Elements that don\'t mach insertion point criteria participate in distribution');
55
56             var a5 = d.querySelector('#a5');
57             assert_not_equals(window.getComputedStyle(a5).display, "none",
58               'Point 3: ::content pseudo-element with relative selector should be a valid insertion point matching criteria, element should be visible');
59         } finally {
60             iframe.parentNode.removeChild(iframe);
61         }
62         A_04_04_01_T2.done();
63     });
64 });
65 </script>
66 </body>
67 </html>