Slide 44
Slide 44 text
Dr. Axel Rauschmayer, Ecmanauten.de
Registering a custom element
var XFoo = document.registerElement('x-foo', { prototype: {
__proto__: HTMLElement.prototype,
!
// Lifecycle: creation of instance
createdCallback: function () { ... },
!
// Lifecycle: instance inserted into document
attachedCallback: function () { ... },
!
// Lifecycle: instance removed from document
detachedCallback: function () { ... },
!
// Lifecycle: attribute added, removed, changed
attributeChangedCallback: function (
attrName, oldVal, newVal) { ... },
} });
44