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 testAll() |
| 17 { |
| 18 test('S1'); |
| 19 test('P1'); |
| 20 test('R1'); |
| 21 test('S2'); |
| 22 test('P2'); |
| 23 test('R2'); |
| 24 test('S3'); |
| 25 test('P3'); |
| 26 test('R3'); |
| 27 } |
| 28 |
| 29 function runTests() |
| 30 { |
| 31 if (window.testRunner) { |
| 32 testRunner.dumpAsText(); |
| 33 testRunner.waitUntilDone(); |
| 34 } |
| 35 |
| 36 log('--- ORIGINAL ---'); |
| 37 testAll(); |
| 38 |
| 39 log('--- AFTER SETTING @SCOPED ---'); |
| 40 document.getElementById('STYLE').setAttribute('scoped', true); |
| 41 setTimeout(function() { |
| 42 testAll(); |
| 43 log('--- FINISHED ---'); |
| 44 if (window.testRunner) |
| 45 testRunner.notifyDone(); |
| 46 }, 0); |
| 47 } |
| 48 </script> |
| 49 <style type="text/css" scoped> |
| 50 body { color: black; } |
| 51 </style> |
| 52 </head> |
| 53 <body onload="runTests();"> |
| 54 <p>Test setting the 'scoped' attribute on a <style> element</p> |
| 55 <div> |
| 56 <span id="S1">Text</span> |
| 57 <p id="P1">Text</p> |
| 58 <pre id="R1">Text</p> |
| 59 </div> |
| 60 <div> |
| 61 <style id="STYLE" type="text/css"> |
| 62 div { color: red; } |
| 63 p { color: green; } |
| 64 p ~ div pre { color: blue; } /* should NOT apply while scoped! */ |
| 65 </style> |
| 66 <span id="S2">Text</span> |
| 67 <p id="P2">Text</p> |
| 68 <pre id="R2">Text</p> |
| 69 </div> |
| 70 <div> |
| 71 <span id="S3">Text</span> |
| 72 <p id="P3">Text</p> |
| 73 <pre id="R3">Text</p> |
| 74 </div> |
| 75 <pre id="console"></pre> |
| 76 </body> |
| 77 </html> |
OLD | NEW |