| <!DOCTYPE html> |
| <head> |
| <style type="text/css"> |
| div:last-child {} |
| </style> |
| <script> |
| |
| if (window.testRunner) |
| testRunner.dumpAsText(); |
| |
| // The bug only reproduces when input is the last element in body |
| // So we have no choice but to run the test on page load. |
| function runTest() { |
| var input = document.body.getElementsByTagName('input')[0]; |
| input.focus(); |
| input.selectionStart = 5; |
| input.selectionEnd = 5; |
| document.execCommand('InsertHTML', false, '<div> world</div>'); |
| var result = input.value == 'hello world' ? 'PASS' : 'FAIL'; |
| input.parentNode.insertBefore(document.createTextNode(result), input); |
| if (window.testRunner) |
| input.parentNode.removeChild(input); |
| } |
| |
| </script> |
| </head> |
| <body onload="runTest()"> |
| <p>This test ensures WebKit can paste content inside an input element even when there is div:last-child {}.</p> |
| <input type="text" value="hello"> |
| </body> |
| </html> |