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_03</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 is a
result of executing a stable algorithm"> |
| 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_03_T1 = async_test('A_04_02_03_T01'); |
| 26 |
| 27 A_04_02_03_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_03_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 //The order of <li> elements at this point should be the following: |
| 44 //li3, li6, li11, li12, 1i13, li14, li15. Other elements (li1, li2,
li4, li5) invisible |
| 45 assert_true(d.querySelector('#li3').offsetTop < d.querySelector('#li
6').offsetTop, |
| 46 'Point 1: Elements that mach insertion point criteria don\'t par
ticipate in distribution'); |
| 47 assert_true(d.querySelector('#li6').offsetTop < d.querySelector('#li
11').offsetTop, |
| 48 'Point 2: Elements that mach insertion point criteria don\'t par
ticipate in distribution'); |
| 49 assert_true(d.querySelector('#li11').offsetTop < d.querySelector('#l
i12').offsetTop, |
| 50 'Point 3: Elements that mach insertion point criteria don\'t par
ticipate in distribution'); |
| 51 assert_true(d.querySelector('#li12').offsetTop < d.querySelector('#l
i13').offsetTop, |
| 52 'Point 4: Elements that mach insertion point criteria don\'t par
ticipate in distribution'); |
| 53 assert_true(d.querySelector('#li13').offsetTop < d.querySelector('#l
i14').offsetTop, |
| 54 'Point 5: Elements that mach insertion point criteria don\'t par
ticipate in distribution'); |
| 55 assert_true(d.querySelector('#li14').offsetTop < d.querySelector('#l
i15').offsetTop, |
| 56 'Point 6: Elements that mach insertion point criteria don\'t par
ticipate in distribution'); |
| 57 |
| 58 assert_equals(d.querySelector('#li1').offsetTop, 0, |
| 59 'Point 7: Elements that don\'t mach insertion point criteria par
ticipate in distribution'); |
| 60 assert_equals(d.querySelector('#li2').offsetTop, 0, |
| 61 'Point 8: Elements that don\'t mach insertion point criteria par
ticipate in distribution'); |
| 62 assert_equals(d.querySelector('#li4').offsetTop, 0, |
| 63 'Point 9: Elements that don\'t mach insertion point criteria par
ticipate in distribution'); |
| 64 assert_equals(d.querySelector('#li5').offsetTop, 0, |
| 65 'Point 10: Elements that don\'t mach insertion point criteria pa
rticipate in distribution'); |
| 66 |
| 67 var subdiv2 = document.createElement('div'); |
| 68 subdiv2.innerHTML = '<ul><content select=".shadow2"></content></ul>'
; |
| 69 s.appendChild(subdiv2); |
| 70 |
| 71 // When class name changed distribution must reoccur |
| 72 //The order of <li> elements should now be the following: |
| 73 //li3, li6, li4, li11, li12, 1i13, li14, li15. Invisible: li1, li2,
li5 |
| 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
4').offsetTop, |
| 77 'Point 12: Elements that mach insertion point criteria don\'t pa
rticipate in distribution'); |
| 78 assert_true(d.querySelector('#li4').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('#li5').offsetTop, 0, |
| 94 'Point 20: Elements that don\'t mach insertion point criteria pa
rticipate in distribution'); |
| 95 |
| 96 var subdiv3 = document.createElement('div'); |
| 97 subdiv3.innerHTML = '<ul><content select=".shadow"></content></ul>'; |
| 98 s.appendChild(subdiv3); |
| 99 |
| 100 //There should be no change. Order: |
| 101 //li3, li6, li4, li11, li12, 1i13, li14, li15. Invisible: li1, li2,
li5 |
| 102 assert_true(d.querySelector('#li3').offsetTop < d.querySelector('#li
6').offsetTop, |
| 103 'Point 21: Elements that mach insertion point criteria don\'t pa
rticipate in distribution'); |
| 104 assert_true(d.querySelector('#li6').offsetTop < d.querySelector('#li
4').offsetTop, |
| 105 'Point 22: Elements that mach insertion point criteria don\'t pa
rticipate in distribution'); |
| 106 assert_true(d.querySelector('#li4').offsetTop < d.querySelector('#li
11').offsetTop, |
| 107 'Point 23: Elements that mach insertion point criteria don\'t pa
rticipate in distribution'); |
| 108 assert_true(d.querySelector('#li11').offsetTop < d.querySelector('#l
i12').offsetTop, |
| 109 'Point 24: Elements that mach insertion point criteria don\'t pa
rticipate in distribution'); |
| 110 assert_true(d.querySelector('#li12').offsetTop < d.querySelector('#l
i13').offsetTop, |
| 111 'Point 25: Elements that mach insertion point criteria don\'t pa
rticipate in distribution'); |
| 112 assert_true(d.querySelector('#li13').offsetTop < d.querySelector('#l
i14').offsetTop, |
| 113 'Point 26: Elements that mach insertion point criteria don\'t pa
rticipate in distribution'); |
| 114 assert_true(d.querySelector('#li14').offsetTop < d.querySelector('#l
i15').offsetTop, |
| 115 'Point 27: Elements that mach insertion point criteria don\'t pa
rticipate in distribution'); |
| 116 |
| 117 assert_equals(d.querySelector('#li1').offsetTop, 0, |
| 118 'Point 28: Elements that don\'t mach insertion point criteria pa
rticipate in distribution'); |
| 119 assert_equals(d.querySelector('#li2').offsetTop, 0, |
| 120 'Point 29: Elements that don\'t mach insertion point criteria pa
rticipate in distribution'); |
| 121 assert_equals(d.querySelector('#li5').offsetTop, 0, |
| 122 'Point 30: Elements that don\'t mach insertion point criteria pa
rticipate in distribution'); |
| 123 } finally { |
| 124 iframe.parentNode.removeChild(iframe); |
| 125 } |
| 126 A_04_02_03_T1.done(); |
| 127 }); |
| 128 }); |
| 129 </script> |
| 130 </body> |
| 131 </html> |
OLD | NEW |