| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <body><div id="tests"><div style="width: 1ex; font-size: 1em; white-space: pre-w
rap;" | 3 <body><div id="tests"><textarea style="width: 1ex; font-size: 1em;" |
| 4 ></div><div style="width: 1ex; font-size: 1em; white-space: pre-wrap; word-wrap:
break-word;" | |
| 5 ></div><textarea style="width: 1ex; font-size: 1em;" | |
| 6 ></textarea></div><pre id="log"></pre><script> | 4 ></textarea></div><pre id="log"></pre><script> |
| 7 | 5 |
| 8 function assertEqual(name, length, endOffset) | 6 function assertEqual(name, length, endOffset) |
| 9 { | 7 { |
| 10 log.textContent += '\n' + name + ': '; | 8 log.textContent += '\n' + name + ': '; |
| 11 if (length != endOffset) | 9 if (length != endOffset) |
| 12 log.textContent += 'FAIL - length was ' + length + ' but selection end w
as ' + endOffset + ' after selecting all text'; | 10 log.textContent += 'FAIL - length was ' + length + ' but selection end w
as ' + endOffset + ' after selecting all text'; |
| 13 else | 11 else |
| 14 log.textContent += 'PASS'; | 12 log.textContent += 'PASS'; |
| 15 } | 13 } |
| 16 | 14 |
| 17 var tests = document.getElementById('tests').childNodes; | 15 var tests = document.getElementById('tests').childNodes; |
| 18 var log = document.getElementById('log'); | 16 var log = document.getElementById('log'); |
| 19 log.textContent = 'This test ensures WebKit renders the trailing whitespace prop
erly. You should see PASS thrice below.\n'; | 17 log.textContent = 'This test ensures WebKit renders the trailing whitespace prop
erly. You should see a PASS below.\n'; |
| 20 | 18 |
| 21 var letter = 'a'; | 19 var letter = 'a'; |
| 22 for (var i = 0; i < tests.length; i++, letter = String.fromCharCode(letter.charC
odeAt(0) + 1)) { | 20 for (var i = 0; i < tests.length; i++, letter = String.fromCharCode(letter.charC
odeAt(0) + 1)) { |
| 23 if (tests[i].select) { | 21 tests[i].value = letter + '\t'; |
| 24 tests[i].value = letter + '\t'; | 22 tests[i].focus(); |
| 25 tests[i].focus(); | 23 tests[i].select(); |
| 26 tests[i].select(); | 24 var endOffset = tests[i].selectionEnd; |
| 27 var endOffset = tests[i].selectionEnd; | |
| 28 } else { | |
| 29 tests[i].textContent = letter + '\t'; | |
| 30 window.getSelection().selectAllChildren(tests[i]); | |
| 31 var endOffset = window.getSelection().getRangeAt(0).endOffset; | |
| 32 } | |
| 33 assertEqual('test ' + i, 2, endOffset); | 25 assertEqual('test ' + i, 2, endOffset); |
| 34 } | 26 } |
| 35 | 27 |
| 36 if (window.testRunner) { | 28 if (window.testRunner) { |
| 37 testRunner.dumpAsText(); | 29 testRunner.dumpAsText(); |
| 38 document.getElementById('tests').style.display = 'none'; | 30 document.getElementById('tests').style.display = 'none'; |
| 39 } | 31 } |
| 40 | 32 |
| 41 </script></pre></body> | 33 </script></pre></body> |
| 42 </html> | 34 </html> |
| OLD | NEW |