blob: 12fcab126ad4d93b6ff6eeef2eae1df2ef922b0b [file]
<html>
<link rel="import" href="../resources/dump-as-text.html" />
<link rel="import" href="../resources/chai.html" />
<body>
This test ensures that is visible in following script block.
<script>
window.callbacksCalled = [];
function fooCreatedFunction() {
assert.deepEqual(window.callbacksCalled, []);
window.callbacksCalled.push(this.tagName);
this.appendChild(document.createElement("x-bar"));
assert.deepEqual(window.callbacksCalled, ['x-foo', 'x-bar']);
}
function barCreatedFunction() {
assert.deepEqual(window.callbacksCalled, ['x-foo']);
window.callbacksCalled.push(this.tagName);
}
document.registerElement("x-foo", { prototype: Object.create(HTMLElement.prototype, { createdCallback: { value: fooCreatedFunction } }) });
document.registerElement("x-bar", { prototype: Object.create(HTMLElement.prototype, { createdCallback: { value: barCreatedFunction } }) });
</script>
<script>
document.createElement("x-foo");
assert.deepEqual(window.callbacksCalled, ['x-foo', 'x-bar']);
</script>
</body>
</html>