OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="resources/shadow-dom.js"></script> | 4 <script src="resources/shadow-dom.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <script> | 7 <script> |
8 function description(text) { | 8 function description(text) { |
9 return createDOM("div", {}, | 9 return createDOM("div", {}, |
10 document.createTextNode(text)); | 10 document.createTextNode(text)); |
11 } | 11 } |
12 | 12 |
13 function createSpanWithText(text) { | 13 function createSpanWithText(text) { |
14 return createDOM("span", {}, | 14 return createDOM("span", {}, |
15 document.createTextNode(text + " ")); | 15 document.createTextNode(text + " ")); |
16 } | 16 } |
17 | 17 |
18 var testcases = [ | 18 var testcases = [ |
19 description('A shadow element with a content element'), | 19 description('A shadow element without an element'), |
20 createDOM('div', {}, | 20 createDOM('div', {}, |
21 createSpanWithText("host-child"), | 21 createSpanWithText("host-child"), |
22 createShadowRoot( | 22 createShadowRoot( |
23 createSpanWithText("before0"), | |
24 createDOM("content", {}), | |
25 createSpanWithText("after0")), | |
26 createShadowRoot( | |
27 createSpanWithText("before1"), | |
28 createDOM("shadow", {}, | |
29 createDOM("content", {})), | |
30 createSpanWithText("after1"))), | |
31 | |
32 description('A shadow element without a content element'), | |
33 createDOM('div', {}, | |
34 createSpanWithText("host-child"), | |
35 createShadowRoot( | |
36 createSpanWithText("before0"), | 23 createSpanWithText("before0"), |
37 createDOM("content", {}), | 24 createDOM("content", {}), |
38 createSpanWithText("after0")), | 25 createSpanWithText("after0")), |
39 createShadowRoot( | 26 createShadowRoot( |
40 createSpanWithText("before1"), | 27 createSpanWithText("before1"), |
41 createDOM("shadow", {}), | 28 createDOM("shadow", {}), |
42 createSpanWithText("after1"))), | 29 createSpanWithText("after1"))), |
43 | 30 |
44 description('A shadow element with a parameter'), | 31 description('A shadow element with an element'), |
45 createDOM('div', {}, | 32 createDOM('div', {}, |
46 createSpanWithText("host-child"), | 33 createSpanWithText("host-child"), |
47 createShadowRoot( | 34 createShadowRoot( |
48 createSpanWithText("before0"), | 35 createSpanWithText("before0"), |
49 createDOM("content", {}), | 36 createDOM("content", {}), |
50 createSpanWithText("after0")), | 37 createSpanWithText("after0")), |
51 createShadowRoot( | 38 createShadowRoot( |
52 createSpanWithText("before1"), | 39 createSpanWithText("before1"), |
53 createDOM("shadow", {}, | 40 createDOM("shadow", {}, |
54 createSpanWithText("shadow-child")), | 41 createSpanWithText("shadow-child")), |
55 createSpanWithText("after1"))), | 42 createSpanWithText("after1"))), |
56 | 43 |
57 description('A shadow element with a content element and a parameter'), | 44 description('A shadow element with a content element and an element'), |
58 createDOM('div', {}, | 45 createDOM('div', {}, |
59 createSpanWithText("host-child"), | 46 createSpanWithText("host-child"), |
60 createShadowRoot( | 47 createShadowRoot( |
61 createSpanWithText("before0"), | 48 createSpanWithText("before0"), |
62 createDOM("content", {}), | 49 createDOM("content", {}), |
63 createSpanWithText("after0")), | 50 createSpanWithText("after0")), |
64 createShadowRoot( | 51 createShadowRoot( |
65 createSpanWithText("before1"), | 52 createSpanWithText("before1"), |
66 createDOM("shadow", {}, | 53 createDOM("shadow", {}, |
67 createDOM("content", {}), | 54 createDOM("content", {}), |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 createSpanWithText("shadow-2-child-2")), | 104 createSpanWithText("shadow-2-child-2")), |
118 createSpanWithText("after2"))), | 105 createSpanWithText("after2"))), |
119 ]; | 106 ]; |
120 | 107 |
121 testcases.forEach(function(element) { | 108 testcases.forEach(function(element) { |
122 document.body.appendChild(element); | 109 document.body.appendChild(element); |
123 }); | 110 }); |
124 </script> | 111 </script> |
125 </body> | 112 </body> |
126 </html> | 113 </html> |
OLD | NEW |