2 <style type=
"text/css">
4 background-color: rgb
(255, 255, 255);
8 background-color: rgb
(102, 204, 255);
12 <script src=
"../../resources/js-test.js"></script>
15 description('Verify that css :target selector is correctly updated during hash and history navigations');
17 // Increase the navigation delay outside test runner to make the effect visible
18 var delay
= window
.testRunner
? 0 : 500;
21 // Location changes need to happen outside the onload handler to generate history entries.
22 setTimeout(function() {
23 window
.location
.hash
= '#target-01';
27 window
.addEventListener('hashchange', function() {
28 if (window
.location
.hash
== "#target-01") {
29 document
.body
.offsetTop
;
30 shouldBeEqualToString("getComputedStyle(document.getElementById('target-01')).backgroundColor", "rgb(102, 204, 255)");
31 setTimeout(function() {
32 window
.history
.back();
35 document
.body
.offsetTop
;
36 shouldBeEqualToString("getComputedStyle(document.getElementById('target-01')).backgroundColor", "rgb(255, 255, 255)");
43 <p>I should be highlighted first because of the anchor, and de-highlighted when there is no fragment.
</p>