| <!DOCTYPE html> |
| <head> |
| <style type="text/css"> |
| div:last-child {} |
| </style> |
| <script> |
| |
| if (window.testRunner) |
| testRunner.dumpAsText(); |
| |
| // The bug only reproduces when textarea 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('textarea')[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 textarea element even when there is div:last-child {}.</p> |
| <textarea>hello</textarea> |
| </body> |
| </html> |