OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script> | 3 <script> |
4 function log(message) | 4 function log(message) |
5 { | 5 { |
6 var element = document.createElement("p"); | 6 var element = document.createElement("p"); |
7 element.appendChild(document.createTextNode(message)); | 7 element.appendChild(document.createTextNode(message)); |
8 document.getElementById("results").appendChild(element); | 8 document.getElementById("results").appendChild(element); |
9 } | 9 } |
10 function runTest() | 10 function runTest() |
11 { | 11 { |
12 if (window.testRunner) | 12 if (window.testRunner) |
13 testRunner.dumpAsText(); | 13 testRunner.dumpAsText(); |
14 if (document.body.scrollTop == 0) | 14 if (document.scrollingElement.scrollTop == 0) |
15 log("PASS: Document is starting scrolled to top."); | 15 log("PASS: Document is starting scrolled to top."); |
16 else | 16 else |
17 log("FAIL: Document is starting scrolled to " + document.body.scrollTop
+ "."); | 17 log("FAIL: Document is starting scrolled to " + document.scrollingElemen
t.scrollTop + "."); |
18 document.getElementById("area").focus(); | 18 document.getElementById("area").focus(); |
19 if (document.body.scrollTop > 4000 && document.body.scrollTop < 6000) | 19 if (document.scrollingElement.scrollTop > 4000 && document.scrollingElement.
scrollTop < 6000) |
20 log("PASS: Focusing area element caused the image to scroll into view.")
; | 20 log("PASS: Focusing area element caused the image to scroll into view.")
; |
21 else | 21 else |
22 log("FAIL: Document is scrolled to " + document.body.scrollTop + " after
focusing area element."); | 22 log("FAIL: Document is scrolled to " + document.scrollingElement.scrollT
op + " after focusing area element."); |
23 document.body.scrollTop = 0; | 23 document.scrollingElement.scrollTop = 0; |
24 if (document.body.scrollTop == 0) | 24 if (document.scrollingElement.scrollTop == 0) |
25 log("PASS: Document is scrolled to top once again."); | 25 log("PASS: Document is scrolled to top once again."); |
26 else | 26 else |
27 log("FAIL: Document should be scrolled to top but is scrolled to " + doc
ument.body.scrollTop + "."); | 27 log("FAIL: Document should be scrolled to top but is scrolled to " + doc
ument.scrollingElement.scrollTop + "."); |
28 document.getElementById("area").blur(); | 28 document.getElementById("area").blur(); |
29 if (document.body.scrollTop == 0) | 29 if (document.scrollingElement.scrollTop == 0) |
30 log("PASS: Document is still scrolled to top after removing focus from a
rea element."); | 30 log("PASS: Document is still scrolled to top after removing focus from a
rea element."); |
31 else | 31 else |
32 log("FAIL: Document is scrolled to " + document.body.scrollTop + " after
removing focus from area element."); | 32 log("FAIL: Document is scrolled to " + document.scrollingElement.scrollT
op + " after removing focus from area element."); |
33 document.body.scrollTop = 0; | 33 document.scrollingElement.scrollTop = 0; |
34 document.body.removeChild(document.getElementById("test")); | 34 document.body.removeChild(document.getElementById("test")); |
35 log("TEST COMPLETE"); | 35 log("TEST COMPLETE"); |
36 } | 36 } |
37 </script> | 37 </script> |
38 </head> | 38 </head> |
39 <body onload="runTest()"> | 39 <body onload="runTest()"> |
40 <div id="results"> | 40 <div id="results"> |
41 <p>This tests to be sure that focusing an area element triggers scrolling and re
moving focus from it does not.</p> | 41 <p>This tests to be sure that focusing an area element triggers scrolling and re
moving focus from it does not.</p> |
42 </div> | 42 </div> |
43 <div id="test"> | 43 <div id="test"> |
44 <div style="height:5000px"></div> | 44 <div style="height:5000px"></div> |
45 <map name="imagemap"> | 45 <map name="imagemap"> |
46 <area id="area" shape="rect" coords="0,0,128,128" href="#dummy"> | 46 <area id="area" shape="rect" coords="0,0,128,128" href="#dummy"> |
47 </map> | 47 </map> |
48 <img src="resources/mu.png" width="128" height="128" usemap="#imagemap" ismap> | 48 <img src="resources/mu.png" width="128" height="128" usemap="#imagemap" ismap> |
49 <div style="height:5000px"></div> | 49 <div style="height:5000px"></div> |
50 <div> | 50 <div> |
51 </body> | 51 </body> |
52 </head> | 52 </head> |
53 </html> | 53 </html> |
OLD | NEW |