| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../../resources/js-test.js"></script> | 4 <script src="../../../resources/js-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 description("This test ensures that the lifecycle callback of a parser-made elem
ent is visible in following script block.") | 6 description("This test ensures that the lifecycle callback of a parser-made elem
ent is visible in following script block.") |
| 7 | 7 |
| 8 window.callbacksCalled = []; | 8 window.callbacksCalled = []; |
| 9 | 9 |
| 10 function fooCreatedFunction() { | 10 function fooCreatedFunction() { |
| 11 shouldBe("window.callbacksCalled", "[]"); | 11 shouldBe("window.callbacksCalled", "[]"); |
| 12 window.callbacksCalled.push(this.tagName); | 12 window.callbacksCalled.push(this.tagName); |
| 13 this.innerHTML = "<x-bar></x-bar>"; | 13 this.innerHTML = "<x-bar></x-bar>"; |
| 14 shouldBe("window.callbacksCalled", "['X-FOO', 'X-BAR']"); | 14 shouldBe("window.callbacksCalled", "['X-FOO', 'X-BAR']"); |
| 15 } | 15 } |
| 16 | 16 |
| 17 function barCreatedFunction() { | 17 function barCreatedFunction() { |
| 18 shouldBe("window.callbacksCalled", "['X-FOO']"); | 18 shouldBe("window.callbacksCalled", "['X-FOO']"); |
| 19 window.callbacksCalled.push(this.tagName); | 19 window.callbacksCalled.push(this.tagName); |
| 20 } | 20 } |
| 21 | 21 |
| 22 document.register("x-foo", { prototype: Object.create(HTMLElement.prototype, { c
reatedCallback: { value: fooCreatedFunction } }) }); | 22 document.registerElement("x-foo", { prototype: Object.create(HTMLElement.prototy
pe, { createdCallback: { value: fooCreatedFunction } }) }); |
| 23 document.register("x-bar", { prototype: Object.create(HTMLElement.prototype, { c
reatedCallback: { value: barCreatedFunction } }) }); | 23 document.registerElement("x-bar", { prototype: Object.create(HTMLElement.prototy
pe, { createdCallback: { value: barCreatedFunction } }) }); |
| 24 </script> | 24 </script> |
| 25 </head> | 25 </head> |
| 26 <body> | 26 <body> |
| 27 <script> | 27 <script> |
| 28 document.createElement("x-foo"); | 28 document.createElement("x-foo"); |
| 29 shouldBe("window.callbacksCalled", "['X-FOO', 'X-BAR']"); | 29 shouldBe("window.callbacksCalled", "['X-FOO', 'X-BAR']"); |
| 30 </script> | 30 </script> |
| 31 </body> | 31 </body> |
| 32 </html> | 32 </html> |
| OLD | NEW |