| <input id="field" onfocus=handleFocus() value="helloworld" onbeforeinput=handleBeforeInput(event)></div> |
| <script src="../../resources/dump-as-markup.js"></script> |
| Markup.description(`To manually test this, copy any text and try to paste into the input field. The value of the input should not change.`); |
| if (!window.internals || !window.eventSender || !window.testRunner) |
| document.querySelector("input").focus(); |
| function handleBeforeInput(event) |
| if (event.inputType == "insertFromPaste") |
| document.querySelector("input").select(); |
| Markup.dump("field", "initial value"); |
| testRunner.execCommand("Cut"); |
| Markup.dump("field", "after the cut"); |
| testRunner.execCommand("Paste"); |
| Markup.dump("field", "after prevented paste"); |
| testRunner.execCommand("Paste"); |
| Markup.dump("field", "after allowed paste"); |