blob: 0f7283e220e8fab1d38fbf356b9cb5b8c6122c30 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test-pre.js"></script>
<script>
description("This test ensures that the lifecycle callback of a parser-made element is visible in following script block.")
document.register = document.register || document.webkitRegister;
window.callbacksCalled = [];
function fooCreatedFunction() {
shouldBe("window.callbacksCalled", "[]");
window.callbacksCalled.push(this.tagName);
this.innerHTML = "<x-bar></x-bar>";
shouldBe("window.callbacksCalled", "['X-FOO', 'X-BAR']");
}
function barCreatedFunction() {
shouldBe("window.callbacksCalled", "['X-FOO']");
window.callbacksCalled.push(this.tagName);
}
document.register("x-foo", { prototype: Object.create(HTMLElement.prototype, { readyCallback: { value: fooCreatedFunction } }) });
document.register("x-bar", { prototype: Object.create(HTMLElement.prototype, { readyCallback: { value: barCreatedFunction } }) });
</script>
</head>
<body>
<script>
document.createElement("x-foo");
shouldBe("window.callbacksCalled", "['X-FOO', 'X-BAR']");
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>