DEV Community

Discussion on: Lets Build Web Components! Part 1: The Standards

Collapse
 
jochemstoel profile image
Jochem Stoel

😀 Thanks for reading! 😁

Thanks for writing. Interesting read and very well written. Looking forward to read part two.

I notice that you too use customElements.define and not document.registerElement. I have been wondering if registerElement is (to be) deprecated but never found a satisfying unopioniated answer.
Do you have any insight?

Collapse
 
bennypowers profile image
Benny Powers 🇮🇱🇨🇦

Exactly right! document.registerElement is deprecated and shouldn't be used.

Collapse
 
jochemstoel profile image
Jochem Stoel

@bennypowers I would like to show you document.defineElement/nativeEleme..., a polyfill for custom elements that does not require a hyphen (-) in the HTML tag. It has been a while now since I created that repository but today I added the nativeElements.define() method because you confirmed that registerElement is deprecated in 2018.

Obviously I am aware that this is generally a bad idea to be doing but perhaps you appreciate it nonetheless.

Thread Thread
 
bennypowers profile image
Benny Powers 🇮🇱🇨🇦
Bad ideas completely overwrite the element and break things make iframes or script tags stop working

🤣