DEV Community

loading...

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

steveblue profile image
Steve Belovarich Author • Edited

No, Safari development team has some valid points, however the rest of the browsers have decided to implement customized built-in elements. Why should Apple engineers continue to resist over implementation details at the cost of failing to enhance Accessibility features for the greater community? Customized built-in elements made it into the spec. At some point they should just accept it.

Thread Thread
lkraav profile image
Leho Kraav • Edited

I don't have an answer to this. Maybe @webpadawan can chime in?

I do like polyfill author's comment github.com/w3c/webcomponents/issue...

With Edge on Chromium, only Safari is missing the train but the polyfill for Safari only, works fast and well, plus Safari is used on powerful devices so performance is not an issue.

Just wondering if safe to bring to my platform production code. We would like to extend article element to starters.

That GH thread should maybe be published as an e-book. Still wondering if I should read all of it.

Thread Thread
webpadawan profile image
Serhii Kulykov

It is better to ask @webreflection who is the author of the customized builtin elements polyfill about how much is it safe to use in production.

The only thing I'm not sure about is whether Safari already supports customElements.upgrade used in that polyfill: github.com/ungap/custom-elements-b...

Thread Thread
webreflection profile image
Andrea Giammarchi

that polyfill is basically for Safari/WebKit only, so yes, it works there pretty well 😉

Thread Thread
yinon profile image
yinon

good helpful info here 🙏
any news with this subject?

Thread Thread
steveblue profile image
Steve Belovarich Author

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
Steve Belovarich Author • 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
Steve Belovarich Author • 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 👋