OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <title>Stylesheets not removed from StyleSheetList when disabled</title> |
| 5 <script src="../resources/testharness.js"></script> |
| 6 <script src="../resources/testharnessreport.js"></script> |
| 7 <link id="s1" rel="stylesheet" title="set" href="data:text/css,#e1{color:red
}"> |
| 8 <link id="s2" rel="alternate stylesheet" type="text/css" title="set" href="d
ata:text/css,#e2{color:red}"> |
| 9 <link id="s3" rel="stylesheet" type="text/css" href="data:text/css,#e3{color
:red}"> |
| 10 <style id="s4">#e4{color:red}</style> |
| 11 <style id="s5" title="set">#e5{color:red}</style> |
| 12 <script> |
| 13 var initialTest = async_test("Check that all stylesheets are initially pre
sent in document.styleSheets"); |
| 14 var colorTest = async_test("Check that no stylesheets are applied when dis
abled"); |
| 15 var testObj = new Object; |
| 16 for (var i=0; i<5; i++) { |
| 17 testObj[i] = async_test("#s"+(i+1)+" accessible through document.styleSh
eets after disabling"); |
| 18 } |
| 19 |
| 20 onload = function(){ |
| 21 |
| 22 var count = document.styleSheets.length; |
| 23 |
| 24 initialTest.step(function(){ |
| 25 assert_equals(count, 5); |
| 26 }); |
| 27 initialTest.done(); |
| 28 |
| 29 var i; |
| 30 |
| 31 for (i=0; i<5; i++) |
| 32 document.getElementById("s"+(i+1)).disabled = true; |
| 33 |
| 34 colorTest.step(function(){ |
| 35 for (i=0; i<5; i++) |
| 36 assert_equals(getComputedStyle(document.getElementById("e"+(i+1))).c
olor, "rgb(0, 128, 0)"); |
| 37 }); |
| 38 colorTest.done(); |
| 39 |
| 40 count = document.styleSheets.length; |
| 41 for (i=0; i<count; i++) |
| 42 testObj[document.styleSheets[i].ownerNode.id] = true; |
| 43 |
| 44 for (i=0; i<5; i++) { |
| 45 testObj[i].step(function(){ |
| 46 assert_true(testObj["s"+(i+1)]); |
| 47 }, "Check if #s"+(i+1)+" is present in document.styleSheets after it i
s disabled"); |
| 48 testObj[i].done(); |
| 49 } |
| 50 }; |
| 51 </script> |
| 52 </head> |
| 53 <body> |
| 54 <div id="log"></div> |
| 55 <div style="color: green"> |
| 56 <span id="e1">This</span> |
| 57 <span id="e2">text</span> |
| 58 <span id="e3">should</span> |
| 59 <span id="e4">be</span> |
| 60 <span id="e5">green</span> |
| 61 </div> |
| 62 </body> |
| 63 </html> |
OLD | NEW |