4 <script src=
"../../../resources/js-test.js"></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
} }) });
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']");