| // 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. |
| var input = document.body.getElementsByTagName('input')[0]; |
| input.selectionStart = 5; |
| document.execCommand('InsertHTML', false, '<div> world</div>'); |
| var result = input.value == 'hello world' ? 'PASS' : 'FAIL'; |
| input.parentNode.insertBefore(document.createTextNode(result), input); |
| input.parentNode.removeChild(input); |
| <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"> |