| <!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 createBox(name) { |
| var div = document.createElement('div'); |
| div.style.width = '100px'; |
| div.style.height = '100px'; |
| div.setAttribute('contenteditable', true); |
| |
| return div; |
| } |
| |
| |
| var shadowRoot = host.webkitCreateShadowRoot(); |
| var div = document.createElement('div'); |
| shadowRoot.appendChild(div); |
| |
| var darkRoot = div.webkitCreateShadowRoot(); |
| var box = createBox('dark'); |
| box.innerHTML = "Kotori Otonashi"; |
| darkRoot.appendChild(box); |
| |
| addListeners(box, 'dark'); |
| addListeners(host, 'host'); |
| |
| if (window.eventSender) { |
| eventSender.mouseMoveTo(box.offsetLeft, box.offsetTop + box.offsetHeight / 2); |
| eventSender.mouseDown(); |
| eventSender.mouseMoveTo(box.offsetLeft + box.offsetWidth, box.offsetTop + box.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> |