1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <script src=
"../../resources/js-test.js"></script>
7 testRunner
.waitUntilDone();
9 window
.jsTestIsAsync
= true;
14 div.class { background-color: red; }
15 :hover {background-color:blue; }
16 :target~#fourth { 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 finds an element whose id is "fourth" and has a sibling that comes before it and whose id matches the fragment of the url of this test.');
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(0, 128, 0)'");