DEV Community

Discussion on: It's not about Web Components vs. React

 
yinon profile image
Yinon Oved

good helpful info here 🙏
any news with this subject?

Thread Thread
 
steveblue profile image
Stephen Belovarich

There is another polyfill now that is regularly maintained customized built-in element support in Safari.

@corpuscule/custom-builtin-elements

Head of WebKit engineering wouldn’t confirm customized built-in elements are on the roadmap, but confirmed Apple never said they wouldn’t support it.

twitter.com/othermaciej/status/121...

Thread Thread
 
webreflection profile image
Andrea Giammarchi • Edited

Unfortunately, it has some problems that make it hard to use. For example, with the @ungap/custom-elements-builtin you cannot use class constructors or create new elements with the new operator.

There is github.com/ungap/custom-elements-new if you want to use new, not sure why that is an issue, but on top of that, there is github.com/WebReflection/document-... that brings custom elements + built-in extends already to every browser down to IE8.

The @ungap/custom-elements-builtin is specific for Safari/WebKit only, which is why it's 1.2K only

curl -Ls https://unpkg.com/@ungap/custom-elements-builtin | brotli | wc -c

that polyfill unminified size is 14K, plus it needs @webcomponents/webcomponentsjs to work, none of mine does.

document-register-element has been used by Google AMP Project for dunno how many years, so it is also battle-tested.

I really wish that polyfill author would've contributed to @ungap instead of creating yet another issue with polyfills and custom elements, I have experience with these since 2014 so maybe we could've solved together.

Thread Thread
 
steveblue profile image
Stephen Belovarich • Edited

I really wish you wouldn’t tell someone you don’t know they are creating issues right off the bat. I’m sure this fumble erases all the times I’ve supported Web Components, am I right? Jeez. People first, not code first. This isn’t an attack on the project or you. Getting along just fine with ‘ @corpuscule/custom-builtin-elements’ in my latest project, which doesn’t need to support deprecated browsers like IE8.

Thread Thread
 
webreflection profile image
Andrea Giammarchi • Edited

I haven't attacked anyone, and me and the @corpuscule/custom-builtin-elements author already clarified a few things in the repository, so that he changed the README about few wrong things mentioned about the @ungap/custom-elements-builtin alternative polyfill.

There are reasons that poly has the constructor caveat, but I'll let you test yourself if it was valid or not.

Thread Thread
 
steveblue profile image
Stephen Belovarich • Edited

I am not saying you attacked anyone, but your phrasing was rude in my opinion. No need for the last paragraph, just gratuitous.

Thread Thread
 
webreflection profile image
Andrea Giammarchi • Edited

I support Web Components (Custom Elements) since 2014 and before, and the @corpuscule/custom-builtin-elements had some FUD in the README regarding my polyfill, but it wasn't intentional, so that everything got sorted by me filing MR to that repository.

I guess there's some history behind you are missing, but the fact people prefer writing from scratch anything already available, instead of helping out, is one of the most obvious reasons Open Source has issues.

So, my comment was about that, and I've clarified with the author of the lib you have pointed me at, so, at least to me, is all good, I hope it's good to you too.

You're free to use whatever library you like, I just know that library has inevitably other issues, but I am not here to describe third party work.

Take care 👋