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 fooCreatedFunction() {
11 shouldBe("window.callbacksCalled", "[]");
12 window
.callbacksCalled
.push(this.tagName
);
13 this.innerHTML
= "<x-bar></x-bar>";
14 shouldBe("window.callbacksCalled", "['X-FOO', 'X-BAR']");
17 function barCreatedFunction() {
18 shouldBe("window.callbacksCalled", "['X-FOO']");
19 window
.callbacksCalled
.push(this.tagName
);
22 document
.registerElement("x-foo", { prototype: Object
.create(HTMLElement
.prototype, { createdCallback
: { value
: fooCreatedFunction
} }) });
23 document
.registerElement("x-bar", { prototype: Object
.create(HTMLElement
.prototype, { createdCallback
: { value
: barCreatedFunction
} }) });
28 document
.createElement("x-foo");
29 shouldBe("window.callbacksCalled", "['X-FOO', 'X-BAR']");