| <!DOCTYPE html> |
| <html> |
| <body> |
| <script src="resources/polyfill.js"></script> |
| <script src="../resources/event-sender-util.js"></script> |
| <script src="../../../resources/js-test-pre.js"></script> |
| |
| <div id="host"></div> |
| <pre id="console"></pre> |
| |
| <script> |
| function addListeners(element, name) { |
| var eventNames = ['copy', 'cut', 'paste']; |
| for (var i = 0; i < eventNames.length; ++i) { |
| (function(i) { |
| element.addEventListener(eventNames[i], function(e) { |
| debug(name + ': ' + eventNames[i] + ' is fired.'); |
| }); |
| })(i); |
| } |
| } |
| |
| function createInput() { |
| var div = document.createElement('input'); |
| div.style.width = '100px'; |
| div.style.height = '100px'; |
| return div; |
| } |
| |
| |
| var shadowRoot = host.webkitCreateShadowRoot(); |
| var div = document.createElement('div'); |
| shadowRoot.appendChild(div); |
| |
| var darkRoot = div.webkitCreateShadowRoot(); |
| var input = createInput(); |
| input.setAttribute('value', 'Kotori Otonashi'); |
| darkRoot.appendChild(input); |
| |
| addListeners(input, 'dark'); |
| addListeners(host, 'host'); |
| |
| if (window.eventSender) { |
| eventSender.mouseMoveTo(input.offsetLeft, input.offsetTop + input.offsetHeight / 2); |
| eventSender.mouseDown(); |
| eventSender.mouseMoveTo(input.offsetLeft + input.offsetWidth, input.offsetTop + input.offsetHeight / 2); |
| eventSender.mouseUp(); |
| } |
| |
| document.execCommand('copy'); |
| document.execCommand('cut'); |
| document.execCommand('paste'); |
| |
| var successfullyParsed = true; |
| </script> |
| |
| <script src="../../../resources/js-test-post.js"></script> |
| </body> |
| </html> |