OLD | NEW |
(Empty) | |
| 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_02_04</title> |
| 14 <link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru"> |
| 15 <link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#lower-b
oundary-encapsulation"> |
| 16 <meta name="assert" content="Lower-boundary encapsulation: The distribution reoc
curs whenever any variable affecting it is changed"> |
| 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_02_04_T1 = async_test('A_04_02_04_T01'); |
| 26 |
| 27 A_04_02_04_T1.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_02_04_T1.step_func(function () { |
| 33 try { |
| 34 var d = iframe.contentDocument; |
| 35 var ul = d.querySelector('ul.stories'); |
| 36 var s = ul.createShadowRoot(); |
| 37 |
| 38 //make shadow subtree |
| 39 var subdiv1 = document.createElement('div'); |
| 40 subdiv1.innerHTML = '<ul><content select=".shadow"></content></ul>'; |
| 41 s.appendChild(subdiv1); |
| 42 |
| 43 |
| 44 //The order of <li> elements at this point should be the following: |
| 45 //li3, li6, li11, li12, 1i13, li14, li15. Other elements (li1, li2,
li4, li5) invisible |
| 46 assert_true(d.querySelector('#li3').offsetTop < d.querySelector('#li
6').offsetTop, |
| 47 'Point 1: Elements that mach insertion point criteria don\'t par
ticipate in distribution'); |
| 48 assert_true(d.querySelector('#li6').offsetTop < d.querySelector('#li
11').offsetTop, |
| 49 'Point 2: Elements that mach insertion point criteria don\'t par
ticipate in distribution'); |
| 50 assert_true(d.querySelector('#li11').offsetTop < d.querySelector('#l
i12').offsetTop, |
| 51 'Point 3: Elements that mach insertion point criteria don\'t par
ticipate in distribution'); |
| 52 assert_true(d.querySelector('#li12').offsetTop < d.querySelector('#l
i13').offsetTop, |
| 53 'Point 4: Elements that mach insertion point criteria don\'t par
ticipate in distribution'); |
| 54 assert_true(d.querySelector('#li13').offsetTop < d.querySelector('#l
i14').offsetTop, |
| 55 'Point 5: Elements that mach insertion point criteria don\'t par
ticipate in distribution'); |
| 56 assert_true(d.querySelector('#li14').offsetTop < d.querySelector('#l
i15').offsetTop, |
| 57 'Point 6: Elements that mach insertion point criteria don\'t par
ticipate in distribution'); |
| 58 |
| 59 assert_equals(d.querySelector('#li1').offsetTop, 0, |
| 60 'Point 7: Elements that don\'t mach insertion point criteria par
ticipate in distribution'); |
| 61 assert_equals(d.querySelector('#li2').offsetTop, 0, |
| 62 'Point 8: Elements that don\'t mach insertion point criteria par
ticipate in distribution'); |
| 63 assert_equals(d.querySelector('#li4').offsetTop, 0, |
| 64 'Point 9: Elements that don\'t mach insertion point criteria par
ticipate in distribution'); |
| 65 assert_equals(d.querySelector('#li5').offsetTop, 0, |
| 66 'Point 10: Elements that don\'t mach insertion point criteria pa
rticipate in distribution'); |
| 67 |
| 68 var li5 = d.querySelector('#li5'); |
| 69 li5.className = 'shadow'; |
| 70 |
| 71 // When class name changed distribution must reoccur |
| 72 //The order of <li> elements should now be the following: |
| 73 //li3, li6, li5, li11, li12, 1i13, li14, li15. Invisible: li1, li2,
li4 |
| 74 assert_true(d.querySelector('#li3').offsetTop < d.querySelector('#li
6').offsetTop, |
| 75 'Point 11: Elements that mach insertion point criteria don\'t pa
rticipate in distribution'); |
| 76 assert_true(d.querySelector('#li6').offsetTop < d.querySelector('#li
5').offsetTop, |
| 77 'Point 12: Elements that mach insertion point criteria don\'t pa
rticipate in distribution'); |
| 78 assert_true(d.querySelector('#li5').offsetTop < d.querySelector('#li
11').offsetTop, |
| 79 'Point 13: Elements that mach insertion point criteria don\'t pa
rticipate in distribution'); |
| 80 assert_true(d.querySelector('#li11').offsetTop < d.querySelector('#l
i12').offsetTop, |
| 81 'Point 14: Elements that mach insertion point criteria don\'t pa
rticipate in distribution'); |
| 82 assert_true(d.querySelector('#li12').offsetTop < d.querySelector('#l
i13').offsetTop, |
| 83 'Point 15: Elements that mach insertion point criteria don\'t pa
rticipate in distribution'); |
| 84 assert_true(d.querySelector('#li13').offsetTop < d.querySelector('#l
i14').offsetTop, |
| 85 'Point 16: Elements that mach insertion point criteria don\'t pa
rticipate in distribution'); |
| 86 assert_true(d.querySelector('#li14').offsetTop < d.querySelector('#l
i15').offsetTop, |
| 87 'Point 17: Elements that mach insertion point criteria don\'t pa
rticipate in distribution'); |
| 88 |
| 89 assert_equals(d.querySelector('#li1').offsetTop, 0, |
| 90 'Point 18: Elements that don\'t mach insertion point criteria pa
rticipate in distribution'); |
| 91 assert_equals(d.querySelector('#li2').offsetTop, 0, |
| 92 'Point 19: Elements that don\'t mach insertion point criteria pa
rticipate in distribution'); |
| 93 assert_equals(d.querySelector('#li4').offsetTop, 0, |
| 94 'Point 20: Elements that don\'t mach insertion point criteria pa
rticipate in distribution'); |
| 95 } finally { |
| 96 iframe.parentNode.removeChild(iframe); |
| 97 } |
| 98 A_04_02_04_T1.done(); |
| 99 }); |
| 100 }); |
| 101 </script> |
| 102 </body> |
| 103 </html> |
OLD | NEW |