blob: ef8ddb11f2e3f579d3df54b8c419941d103ecc28 [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 trackingReadyCallback()
{
window.callbacksCalled.push(this.id);
}
document.register("x-foo", { prototype: Object.create(HTMLElement.prototype, { readyCallback: { value: trackingReadyCallback } }) });
document.register("x-bar", { prototype: Object.create(HTMLDivElement.prototype, { readyCallback: { value: trackingReadyCallback } }) });
document.register("x-baz", { prototype: Object.create(HTMLElement.prototype, { readyCallback: { value: trackingReadyCallback } }) });
</script>
</head>
<body>
<div id="container">
<script>
// Testing element siblings
window.callbacksCalled = [];
container.innerHTML = "<x-foo id='a'></x-foo><div id='b' is='x-bar'></div><x-baz id='c'></x-baz>";
shouldBe("window.callbacksCalled", "['a', 'b', 'c']");
// Testing nested elements
window.callbacksCalled = [];
container.innerHTML = "<x-foo id='a'><div id='b' is='x-bar'><x-baz id='c'></x-baz></div></x-foo>";
shouldBe("window.callbacksCalled", "['a', 'b', 'c']");
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>