blob: d26706f891d2c7b7b16d8cb7d3cb2caa1b176ae3 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script>
description("This test ensures that the lifecycle callbacks of editing-originated elements are visible in following script block.")
window.callbacksCalled = [];
document.registerElement("x-foo", { prototype: Object.create(HTMLElement.prototype, { createdCallback: { value: function() { window.callbacksCalled.push(this.tagName); } } }) });
document.registerElement("x-bar", { extends: "div", prototype: Object.create(HTMLDivElement.prototype, { createdCallback: { 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>
</body>
</html>