| OLD | NEW |
| (Empty) |
| 1 <body style="margin: 0"> | |
| 2 <div style="margin: 50px; background-color: lightblue; width: 800px; height: 200
px; -webkit-column-width:185px; -webkit-column-gap:15px; column-width:185px; col
umn-gap:15px; column-fill:auto; font-family: Ahem; font-size: 50px; line-height:
1;"> | |
| 3 123<div style="background-color: blue; height: 70px;"></div>abc<br>def<div s
tyle="background-color: blue; height: 60px;"></div>ghi<br>jkl<div style="backgro
und-color: blue; height: 110px;"></div>mno</div> | |
| 4 <pre id="console" style="display: none;"></pre> | |
| 5 <script> | |
| 6 function characterAtPoint(x, y) | |
| 7 { | |
| 8 var range = document.caretRangeFromPoint(x, y); | |
| 9 if (range.startContainer.nodeType !== Node.TEXT_NODE) | |
| 10 return null; | |
| 11 if (range.startOffset >= range.startContainer.length) | |
| 12 return null; | |
| 13 return range.startContainer.data[range.startOffset]; | |
| 14 } | |
| 15 | |
| 16 function log(message) | |
| 17 { | |
| 18 document.getElementById("console").appendChild(document.createTextNode(m
essage + "\n")); | |
| 19 } | |
| 20 | |
| 21 function test(x, y, character) | |
| 22 { | |
| 23 var actualCharacter = characterAtPoint(x, y); | |
| 24 if (character === actualCharacter) | |
| 25 log ("Character at " + x + ", " + y + " is " + character + " as expe
cted."); | |
| 26 else | |
| 27 log ("FAIL: Character at " + x + ", " + y + " is " + actualCharacter
+ ". Expected " + character + "."); | |
| 28 } | |
| 29 | |
| 30 if (window.testRunner) | |
| 31 testRunner.dumpAsText(); | |
| 32 | |
| 33 test(150, 25, "1"); | |
| 34 test(350, 25, "d"); | |
| 35 test(550, 25, "j"); | |
| 36 test(750, 25, "m"); | |
| 37 | |
| 38 test(150, 275, "d"); | |
| 39 test(350, 275, "j"); | |
| 40 test(550, 275, "m"); | |
| 41 test(750, 275, null); | |
| 42 | |
| 43 test(150, 475, "d"); | |
| 44 test(350, 475, "j"); | |
| 45 test(550, 475, "m"); | |
| 46 test(750, 475, null); | |
| 47 | |
| 48 document.getElementById("console").style.display = "block"; | |
| 49 </script> | |
| OLD | NEW |