Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / custom / lifecycle-created-innerHTML.html
blob336d6cba20c21d5dcc2088611d8b18978818e918
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../resources/js-test.js"></script>
5 <script>
6 description("This test ensures that the lifecycle callback of a parser-made element is visible in following script block.")
8 window.callbacksCalled = [];
10 function trackingReadyCallback()
12 window.callbacksCalled.push(this.id);
15 document.registerElement("x-foo", { prototype: Object.create(HTMLElement.prototype, { createdCallback: { value: trackingReadyCallback } }) });
16 document.registerElement("x-bar", { extends: "div", prototype: Object.create(HTMLDivElement.prototype, { createdCallback: { value: trackingReadyCallback } }) });
17 document.registerElement("x-baz", { prototype: Object.create(HTMLElement.prototype, { createdCallback: { value: trackingReadyCallback } }) });
18 </script>
19 </head>
20 <body>
21 <div id="container">
22 <script>
23 // Testing element siblings
24 window.callbacksCalled = [];
25 container.innerHTML = "<x-foo id='a'></x-foo><div id='b' is='x-bar'></div><x-baz id='c'></x-baz>";
26 shouldBe("window.callbacksCalled", "['a', 'b', 'c']");
28 // Testing nested elements
29 window.callbacksCalled = [];
30 container.innerHTML = "<x-foo id='a'><div id='b' is='x-bar'><x-baz id='c'></x-baz></div></x-foo>";
31 shouldBe("window.callbacksCalled", "['a', 'b', 'c']");
32 </script>
33 </body>
34 </html>