| OLD | NEW |
| 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.or
g/TR/html4/loose.dtd"> | 1 <!DOCTYPE html> |
| 2 <html> | |
| 3 <head> | |
| 4 <style type="text/css"> | 2 <style type="text/css"> |
| 5 div:target { | 3 div { |
| 6 background-color: #66CCFF; | 4 background-color: rgb(255, 255, 255); |
| 7 } | 5 } |
| 6 |
| 7 div:target { |
| 8 background-color: rgb(102, 204, 255); |
| 9 } |
| 8 </style> | 10 </style> |
| 11 |
| 12 <script src="../../resources/js-test.js"></script> |
| 9 <script> | 13 <script> |
| 10 function test() | 14 jsTestIsAsync = true; |
| 11 { | 15 description('Verify that css :target selector is correctly updated during hash
and history navigations'); |
| 12 if (window.testRunner) | |
| 13 testRunner.waitUntilDone(); | |
| 14 | 16 |
| 17 // Increase the navigation delay outside test runner to make the effect visibl
e |
| 18 var delay = window.testRunner ? 0 : 500; |
| 19 |
| 20 onload = function() { |
| 15 // Location changes need to happen outside the onload handler to generate hi
story entries. | 21 // Location changes need to happen outside the onload handler to generate hi
story entries. |
| 16 setTimeout(runTest, 0); | 22 setTimeout(function() { |
| 17 } | 23 window.location.hash = '#target-01'; |
| 24 }, delay); |
| 25 }; |
| 18 | 26 |
| 19 function runTest() { | 27 window.addEventListener('hashchange', function() { |
| 20 window.location.hash ='#target-01'; | 28 if (window.location.hash == "#target-01") { |
| 21 document.body.offsetTop; | 29 document.body.offsetTop; |
| 22 window.history.back(); // This queues up a navigation, so we need to delay t
he call to notifyDone. | 30 shouldBeEqualToString("getComputedStyle(document.getElementById('target-01
')).backgroundColor", "rgb(102, 204, 255)"); |
| 23 if (window.testRunner) | 31 setTimeout(function() { |
| 24 window.onpopstate = function() { testRunner.notifyDone() }; | 32 window.history.back(); |
| 25 } | 33 }, delay); |
| 34 } else { |
| 35 document.body.offsetTop; |
| 36 shouldBeEqualToString("getComputedStyle(document.getElementById('target-01
')).backgroundColor", "rgb(255, 255, 255)"); |
| 37 finishJSTest(); |
| 38 } |
| 39 }); |
| 26 </script> | 40 </script> |
| 27 </head> | |
| 28 <body onload="test()"> | |
| 29 | 41 |
| 30 <div id="target-01"> | 42 <div id="target-01"> |
| 31 <p>I should be highlighted first because of the anchor, and de-highlighted whe
n there is no fragment.</p> | 43 <p>I should be highlighted first because of the anchor, and de-highlighted whe
n there is no fragment.</p> |
| 32 </div> | 44 </div> |
| 33 | |
| 34 </body></html> | |
| OLD | NEW |