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: 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">
25 var A_04_04_01_T2 = async_test('A_04_04_01_T02');
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);
32 iframe.onload = A_04_04_01_T2.step_func(function () {
34 var d = iframe.contentDocument;
37 var ul = d.querySelector('ul.stories');
39 var subdiv1 = d.createElement('div');
40 subdiv1.innerHTML = '<ul><content select="li"></content></ul>';
41 s.appendChild(subdiv1);
43 var shadowStyle = d.createElement('style');
44 shadowStyle.innerHTML = '*::content > .shadow { display:none; }';
45 s.appendChild(shadowStyle);
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');
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');
60 iframe.parentNode.removeChild(iframe);