| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../../resources/js-test-pre.js"></script> |
| <script> |
| description("This test ensures that the lifecycle callbacks of editing-originated elements are visible in following script block.") |
| document.register = document.register || document.webkitRegister; |
| window.callbacksCalled = []; |
| document.register("x-foo", { prototype: Object.create(HTMLElement.prototype, { readyCallback: { value: function() { window.callbacksCalled.push(this.tagName); } } }) }); |
| document.register("x-bar", { prototype: Object.create(HTMLDivElement.prototype, { readyCallback: { value: function() { window.callbacksCalled.push(this.tagName); } } }) }); |
| </script> |
| </head> |
| <body> |
| <div id="container" contenteditable>[<x-foo>Foo</x-foo><div is='x-bar'>Bar</div>]</div> |
| <script> |
| var selection = window.getSelection(); |
| |
| selection.selectAllChildren(container); |
| document.execCommand("Copy"); |
| |
| shouldBe("window.callbacksCalled", "['X-FOO', 'DIV']"); |
| selection.collapseToEnd(); |
| document.execCommand("Paste"); |
| shouldBe("window.callbacksCalled", "['X-FOO', 'DIV', 'X-FOO', 'DIV']"); |
| |
| container.style.display = "none"; |
| </script> |
| <script src="../../../resources/js-test-post.js"></script> |
| </body> |
| </html> |