wenson_hsieh@apple.com | 036f955 | 2016-10-25 20:23:10 +0000 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <body> |
| 4 | <div id="source" contenteditable onbeforeinput=beforeInput(event)></div> |
| 5 | <div id="destination" contenteditable></div> |
| 6 | <script src="../../resources/dump-as-markup.js"></script> |
| 7 | <script> |
| 8 | Markup.description(`To manually test this, make a typo in the first contenteditable and use spell checking to correct it. The corrected value should appear below.`); |
| 9 | source.focus(); |
| 10 | |
| 11 | if (window.internals && window.eventSender) { |
| 12 | internals.settings.setInputEventsEnabled(true); |
| 13 | eventSender.keyDown("e", []); |
| 14 | eventSender.keyDown("s", []); |
| 15 | eventSender.keyDown("c", []); |
| 16 | internals.handleAcceptedCandidate("<p>escape me!</p>", 0, 3); |
| 17 | } |
| 18 | |
| 19 | Markup.dump("destination", "after autocorrection"); |
| 20 | |
| 21 | function beforeInput(event) |
| 22 | { |
| 23 | if (!event.dataTransfer) |
| 24 | return; |
| 25 | |
| 26 | destination.innerHTML = event.dataTransfer.getData("text/html"); |
| 27 | event.preventDefault(); |
| 28 | } |
| 29 | </script> |
| 30 | </body> |
| 31 | </html> |