| <html> |
| <head> |
| <style> |
| body { margin: 10; padding: 0 } |
| </style> |
| </head> |
| <body contenteditable><div><br></div>hello<br> |
| <script type="text/javascript"> |
| |
| var console_messages = document.createElement("ol"); |
| |
| function log(message) |
| { |
| var item = document.createElement("li"); |
| var resultMessage = String(message); |
| |
| // remove any memory addresses to make the test reproducable |
| resultMessage = resultMessage.replace(/0x[0-9a-fA-F]{8}/g, "0xXXXXXXXX"); |
| |
| // Leopard serializes empty attribute dictionaries as "{ }", turn these into "{}" to match Tiger |
| resultMessage = resultMessage.replace(/\{\s\}/g, "{}"); |
| |
| item.appendChild(document.createTextNode(resultMessage)); |
| console_messages.appendChild(item); |
| } |
| |
| if (window.layoutTestController) { |
| |
| try { |
| |
| layoutTestController.dumpAsText(); |
| |
| log("Testing text with br elements (<div><br></div>hello<br>)"); |
| window.getSelection().setPosition(document.body, 5); |
| |
| log("(0, 0): " + textInputController.attributedSubstringFromRange(0, 0)); |
| log("(0, 1): " + textInputController.attributedSubstringFromRange(0, 1)); |
| log("(0, 2): " + textInputController.attributedSubstringFromRange(0, 2)); |
| log("(1, 1): " + textInputController.attributedSubstringFromRange(1, 1)); |
| log("(1, 5): " + textInputController.attributedSubstringFromRange(1, 5)); |
| log("(1, 6): " + textInputController.attributedSubstringFromRange(1, 6)); |
| log("(1, 100): " + textInputController.attributedSubstringFromRange(1, 100)); |
| log("(6, 1): " + textInputController.attributedSubstringFromRange(6, 1)); |
| log("(7, 1): " + textInputController.attributedSubstringFromRange(7, 1)); // should be empty |
| log("(100, 0): " + textInputController.attributedSubstringFromRange(100, 0)); // should be undefined |
| log("(100, 100): " + textInputController.attributedSubstringFromRange(100, 100)); // should be undefined |
| |
| document.body.innerHTML = ""; |
| |
| } catch (ex) { |
| log("Exception: " + ex.description); |
| } |
| |
| var console = document.createElement("p"); |
| console.appendChild(console_messages); |
| document.body.appendChild(console); |
| |
| } else { |
| document.write("This testcase is buggy: 9337. (cannot run interactively)"); |
| } |
| </script> |
| </body> |
| </html> |