+ 1
how to deal with two super() in java script
suppose i have two classes: class A extends HTMLElement{ constructor(){ super(); //to access "this" of HTMLElement } } class B extends A{ constructor(){ super(); //to access "this" of class A } } but this shows error: Illegal constructor at new A (xyz.js:6) // saying that super() of class A is an illegal constructor at new B(xyz.js:15) // saying the same as above at xyz.js:23 plz help !!! how can i fix this .
1 Answer
+ 1
you have to register your custom element in CustomElementRegistry using the define() method:
https://code.sololearn.com/Wbo21pXOB5ZV/#js
https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements