OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script type="text/javascript"> |
| 5 function log(msg) |
| 6 { |
| 7 document.getElementById('console').appendChild(document.createTextNo
de(msg + '\n')); |
| 8 } |
| 9 |
| 10 function test(id) |
| 11 { |
| 12 var elem = document.getElementById(id); |
| 13 log(id + ': ' + document.defaultView.getComputedStyle(elem, null).ge
tPropertyValue('color')); |
| 14 } |
| 15 |
| 16 function runTests() |
| 17 { |
| 18 if (window.testRunner) |
| 19 testRunner.dumpAsText(); |
| 20 |
| 21 log('--- COMPUTED STYLES ---'); |
| 22 |
| 23 test('S1'); |
| 24 test('P1'); |
| 25 test('R1'); |
| 26 test('E1'); |
| 27 log(''); |
| 28 test('S2'); |
| 29 test('P2'); |
| 30 test('R2'); |
| 31 test('E2'); |
| 32 log(''); |
| 33 test('S3'); |
| 34 test('P3'); |
| 35 test('R3'); |
| 36 test('E3'); |
| 37 log(''); |
| 38 test('S4'); |
| 39 test('P4'); |
| 40 test('R4'); |
| 41 test('E4'); |
| 42 |
| 43 log('--- FINISHED ---'); |
| 44 } |
| 45 </script> |
| 46 <style type="text/css"> |
| 47 body { color: black; } |
| 48 </style> |
| 49 </head> |
| 50 <body onload="runTests();"> |
| 51 <p>Test <style scoped></p> |
| 52 <div class="foo"> |
| 53 <span id="S1">Text</span> |
| 54 <p id="P1">Text</p> |
| 55 <pre id="R1" class="bar">Text</pre> |
| 56 <pre id="E1" class="baz">Text</pre> |
| 57 </div> |
| 58 <div id="foo"> |
| 59 <div id="sib"></div> |
| 60 <div> |
| 61 <style type="text/css" scoped> |
| 62 div { color: red; } |
| 63 p { color: green; } |
| 64 div .bar { color: blue; } |
| 65 #foo .baz { color: rgb(10, 10, 10); } /* should NOT apply! */ |
| 66 #sib + * { color: rgb(20, 20, 20); } /* should NOT apply! */ |
| 67 #sib ~ * { color: rgb(30, 30, 30); } /* should NOT apply! */ |
| 68 div div { color: rgb(40, 40, 40); } /* should NOT apply! */ |
| 69 </style> |
| 70 <span id="S2">Text</span> |
| 71 <p id="P2">Text</p> |
| 72 <pre id="R2" class="bar">Text</pre> |
| 73 <pre id="E2" class="baz">Text</pre> |
| 74 </div> |
| 75 <span id="S3">Text</span> |
| 76 <p id="P3">Text</p> |
| 77 <pre id="R3" class="bar">Text</pre> |
| 78 <pre id="E3" class="baz">Text</pre> |
| 79 </div> |
| 80 <div class="foo"> |
| 81 <span id="S4">Text</span> |
| 82 <p id="P4">Text</p> |
| 83 <pre id="R4" class="bar">Text</pre> |
| 84 <pre id="E4" class="baz">Text</pre> |
| 85 </div> |
| 86 <pre id="console"></pre> |
| 87 </body> |
| 88 </html> |
OLD | NEW |