1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
4 <script src="../js/resources/js-test-pre.js"></script>
6 if (window.layoutTestController)
7 layoutTestController.waitUntilDone();
9 window.jsTestIsAsync = true;
14 div.class { background-color: red; }
15 :hover {background-color:blue; }
16 :target~#first { background-color: green; }
20 <body onhashchange="hashchange();">
21 <p id="description"></p>
22 <div tabindex=1" id="first" class="class"></div>
23 <div tabindex=2" id="second" class="class"></div>
24 <div tabindex=3" id="third" class="class"></div>
25 <div tabindex=4" id="fourth" class="class"></div>
26 <div id="console"></div>
28 description('This test passes if it does not find the element whose id is "first", because even though it has a sibling whose id matches the fragment of the url of this test, that sibling comes after, not before the "first" element.');
31 if (window.location.hash.indexOf("second") == -1)
32 window.location.hash = "#second";
34 function hashchange() {
35 el = document.getElementById("first");
36 shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('background-color')", "'rgb(255, 0, 0)'");
38 el = document.getElementById("second");
39 shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('background-color')", "'rgb(255, 0, 0)'");
41 el = document.getElementById("third");
42 shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('background-color')", "'rgb(255, 0, 0)'");
44 el = document.getElementById("fourth");
45 shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('background-color')", "'rgb(255, 0, 0)'");
49 <script src="../js/resources/js-test-post.js"></script>