Bug 1416999 - Remove document.registerElement

Tag #1375
This commit is contained in:
Matt A. Tobin 2020-04-17 07:07:09 -04:00 committed by Roy Tam
commit cedff6e214
28 changed files with 82 additions and 879 deletions

View file

@ -18,23 +18,19 @@ SimpleTest.waitForExplicitFinish();
var connectedCallbackCount = 0;
var p = Object.create(HTMLElement.prototype);
p.createdCallback = function() {
ok(true, "createdCallback called.");
class Foo extends HTMLElement {
connectedCallback() {
ok(true, "connectedCallback should be called when the parser creates an element in the document.");
connectedCallbackCount++;
// connectedCallback should be called twice, once for the element created for innerHTML and
// once for the element created in this document.
if (connectedCallbackCount == 2) {
SimpleTest.finish();
}
}
};
p.connectedCallback = function() {
ok(true, "connectedCallback should be called when the parser creates an element in the document.");
connectedCallbackCount++;
// connectedCallback should be called twice, once for the element created for innerHTML and
// once for the element created in this document.
if (connectedCallbackCount == 2) {
SimpleTest.finish();
}
}
document.registerElement("x-foo", { prototype: p });
customElements.define("x-foo", Foo);
var container = document.getElementById("container");
container.innerHTML = '<x-foo></x-foo>';