| 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('S2'); | |
| 21 test('P2'); | |
| 22 test('S3'); | |
| 23 test('P3'); | |
| 24 } | |
| 25 | |
| 26 function runTests() | |
| 27 { | |
| 28 if (window.testRunner) { | |
| 29 testRunner.dumpAsText(); | |
| 30 testRunner.waitUntilDone(); | |
| 31 } | |
| 32 | |
| 33 log('--- ORIGINAL ---'); | |
| 34 testAll(); | |
| 35 | |
| 36 log('--- AFTER ATTACHING <STYLE SCOPED> ---'); | |
| 37 var divElem = document.getElementById('DIV'); | |
| 38 var styleElem = document.createElement('style'); | |
| 39 styleElem.setAttribute('scoped', true); | |
| 40 styleElem.innerHTML = 'div { color: red; } p { color: green; }'; | |
| 41 divElem.insertBefore(styleElem, divElem.firstChild); | |
| 42 setTimeout(function() { | |
| 43 testAll(); | |
| 44 log('--- FINISHED ---'); | |
| 45 if (window.testRunner) | |
| 46 testRunner.notifyDone(); | |
| 47 }, 0); | |
| 48 } | |
| 49 </script> | |
| 50 <style type="text/css" scoped> | |
| 51 body { color: black; } | |
| 52 </style> | |
| 53 </head> | |
| 54 <body onload="runTests();"> | |
| 55 <p>Test attaching a new <style scoped> element</p> | |
| 56 <div> | |
| 57 <span id="S1">Text</span> | |
| 58 <p id="P1">Text</p> | |
| 59 </div> | |
| 60 <div id="DIV"> | |
| 61 <span id="S2">Text</span> | |
| 62 <p id="P2">Text</p> | |
| 63 </div> | |
| 64 <div> | |
| 65 <span id="S3">Text</span> | |
| 66 <p id="P3">Text</p> | |
| 67 </div> | |
| 68 <pre id="console"></pre> | |
| 69 </body> | |
| 70 </html> | |
| OLD | NEW |