4 <script src=
"../../../resources/js-test.js"></script>
6 description("This test ensures that the lifecycle callbacks of editing-originated elements are visible in following script block.")
7 window
.callbacksCalled
= [];
8 document
.registerElement("x-foo", { prototype: Object
.create(HTMLElement
.prototype, { createdCallback
: { value: function() { window
.callbacksCalled
.push(this.tagName
); } } }) });
9 document
.registerElement("x-bar", { extends: "div", prototype: Object
.create(HTMLDivElement
.prototype, { createdCallback
: { value: function() { window
.callbacksCalled
.push(this.tagName
); } } }) });
13 <div id=
"container" contenteditable
>[
<x-foo>Foo
</x-foo><div is='x-bar'
>Bar
</div>]
</div>
15 var selection
= window
.getSelection();
17 selection
.selectAllChildren(container
);
18 document
.execCommand("Copy");
20 shouldBe("window.callbacksCalled", "['X-FOO', 'DIV']");
21 selection
.collapseToEnd();
22 document
.execCommand("Paste");
23 shouldBe("window.callbacksCalled", "['X-FOO', 'DIV', 'X-FOO', 'DIV']");
25 container
.style
.display
= "none";