| OLD | NEW |
| 1 <?xml-stylesheet href="resources/detached-style.css" media="screen"?> | 1 <?xml-stylesheet href="resources/detached-style.css" media="screen"?> |
| 2 <html xmlns="http://www.w3.org/1999/xhtml"> | 2 <html xmlns="http://www.w3.org/1999/xhtml"> |
| 3 <head> | 3 <head> |
| 4 <title/> | 4 <title/> |
| 5 </head> | 5 </head> |
| 6 <body onload="finishTest()"> | 6 <body onload="finishTest()"> |
| 7 <p><a href="https://bugs.webkit.org/show_bug.cgi?id=45205">Bug 45205</a>: | 7 <p><a href="https://bugs.webkit.org/show_bug.cgi?id=45205">Bug 45205</a>: |
| 8 Test that <xml-stylesheet> processing instructions only have stylesheets when
in document.</p> | 8 Test that <xml-stylesheet> processing instructions only have stylesheets when
in document.</p> |
| 9 <pre id="result"></pre> | 9 <pre id="result"></pre> |
| 10 <script> | 10 <script> |
| 11 if (window.testRunner) | 11 <![CDATA[ |
| 12 if (window.testRunner) { |
| 12 testRunner.dumpAsText(); | 13 testRunner.dumpAsText(); |
| 14 testRunner.waitUntilDone(); |
| 15 } |
| 13 | 16 |
| 14 sheet = document.styleSheets[0]; | 17 sheet = document.styleSheets[0]; |
| 15 pi = document.firstChild; | 18 pi = document.firstChild; |
| 16 result = document.getElementById("result"); | 19 result = document.getElementById("result"); |
| 17 | 20 |
| 18 document.removeChild(pi); | 21 document.removeChild(pi); |
| 19 | 22 |
| 20 function finishTest() | 23 function finishTest() |
| 21 { | 24 { |
| 22 result.innerHTML += "Not in document: " + ((pi.sheet === null) ? "PASS" : ("
FAIL: " + pi.sheet)) + "\n"; | 25 result.innerHTML += "Not in document: " + ((pi.sheet === null) ? "PASS" : ("
FAIL: " + pi.sheet)) + "\n"; |
| 23 | 26 |
| 24 document.appendChild(pi); | 27 document.appendChild(pi); |
| 25 | 28 window.requestAnimationFrame(finishTest2); |
| 26 // This subtest fails in Firefox 4.0b8 - apparently, adding a processing ins
truction doens't trigger load. | |
| 27 result.innerHTML += "After adding to document: " + ((pi.sheet === null) ? ("
FAIL: " + pi.sheet) : "PASS") + "\n"; | |
| 28 | |
| 29 result.innerHTML += "DONE"; | |
| 30 } | 29 } |
| 31 | 30 |
| 31 var retryCount = 0; |
| 32 |
| 33 function finishTest2() { |
| 34 // This subtest may fail because loading the resource may not complete immed
iately after |
| 35 // appendChild(). |
| 36 if (pi.sheet === null && ++retryCount < 10) { |
| 37 window.requestAnimationFrame(finishTest2); |
| 38 return; |
| 39 } |
| 40 |
| 41 result.innerHTML += "After adding to document: " + ((pi.sheet === null) ? ("
FAIL: " + pi.sheet) : "PASS") + "\n"; |
| 42 result.innerHTML += "DONE"; |
| 43 if (window.testRunner) |
| 44 testRunner.notifyDone(); |
| 45 } |
| 46 ]]> |
| 32 </script> | 47 </script> |
| 33 </body> | 48 </body> |
| 34 </html> | 49 </html> |
| OLD | NEW |