Closed
Description
This transplies and works as expected (in chrome and opera and firefox since custom elements are fully implemented) but, if you paste it on the playground it will display some errors
class View extends HTMLElement{
createdCallback() {
var template = document.querySelector('#t1');
var clone = template.content.cloneNode(true);
var root = this.createShadowRoot();
root.appendChild(clone);
console.log("View created");
}
attachedCallback(){
console.log("View attached");
}
detachedCallback(){
console.log("View detached");
}
attributeChangedCallback(attrName,oldVal,newVale){
console.log(`attribute ${attrName} changed from ${oldVal} to ${newVale}`);
}
}
document.registerElement('x-view', View);
those are:
1-A class may only extend another class.
2-Property content does not exist on type Element, Element is of type HTMLTemplate
3-createShadowRoot() does not exist on type View
4-registerElement does not exist in document definition..