OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../../resources/js-test.js"></script> | 4 <script src="../../../resources/js-test.js"></script> |
5 <script> | 5 <script> |
6 description("This test ensures that the lifecycle callbacks of editing-originate
d elements are visible in following script block.") | 6 description("This test ensures that the lifecycle callbacks of editing-originate
d elements are visible in following script block.") |
7 window.callbacksCalled = []; | 7 window.callbacksCalled = []; |
8 document.register("x-foo", { prototype: Object.create(HTMLElement.prototype, { c
reatedCallback: { value: function() { window.callbacksCalled.push(this.tagName);
} } }) }); | 8 document.registerElement("x-foo", { prototype: Object.create(HTMLElement.prototy
pe, { createdCallback: { value: function() { window.callbacksCalled.push(this.ta
gName); } } }) }); |
9 document.register("x-bar", { extends: "div", prototype: Object.create(HTMLDivEle
ment.prototype, { createdCallback: { value: function() { window.callbacksCalled.
push(this.tagName); } } }) }); | 9 document.registerElement("x-bar", { extends: "div", prototype: Object.create(HTM
LDivElement.prototype, { createdCallback: { value: function() { window.callbacks
Called.push(this.tagName); } } }) }); |
10 </script> | 10 </script> |
11 </head> | 11 </head> |
12 <body> | 12 <body> |
13 <div id="container" contenteditable>[<x-foo>Foo</x-foo><div is='x-bar'>Bar</div>
]</div> | 13 <div id="container" contenteditable>[<x-foo>Foo</x-foo><div is='x-bar'>Bar</div>
]</div> |
14 <script> | 14 <script> |
15 var selection = window.getSelection(); | 15 var selection = window.getSelection(); |
16 | 16 |
17 selection.selectAllChildren(container); | 17 selection.selectAllChildren(container); |
18 document.execCommand("Copy"); | 18 document.execCommand("Copy"); |
19 | 19 |
20 shouldBe("window.callbacksCalled", "['X-FOO', 'DIV']"); | 20 shouldBe("window.callbacksCalled", "['X-FOO', 'DIV']"); |
21 selection.collapseToEnd(); | 21 selection.collapseToEnd(); |
22 document.execCommand("Paste"); | 22 document.execCommand("Paste"); |
23 shouldBe("window.callbacksCalled", "['X-FOO', 'DIV', 'X-FOO', 'DIV']"); | 23 shouldBe("window.callbacksCalled", "['X-FOO', 'DIV', 'X-FOO', 'DIV']"); |
24 | 24 |
25 container.style.display = "none"; | 25 container.style.display = "none"; |
26 </script> | 26 </script> |
27 </body> | 27 </body> |
28 </html> | 28 </html> |
OLD | NEW |