Hacker News new | ask | show | jobs
by aaimnr 3169 days ago
"Custom Elements, the interoperability aspect from the Web Components Spec, are a good primitive for integration in the browser. Each team builds their component using their web technology of choice and wraps it inside a Custom Element (e.g. <order-minicart></order-minicart>). The DOM specification of this particular element (tag-name, attributes & events) acts as the contract or public API for other teams. The advantage is that they can use the component and its functionality without having to know the implementation. They just have to be able to interact with the DOM."

Seems like an interesting idea, but it's barely supported at the moment: https://caniuse.com/#search=custom

2 comments

> Seems like an interesting idea, but it's barely supported at the moment

You can polyfill custom-elements to all evergreen browsers plus IE11 [1], but yeah that's not good enough for a lot of sites.

[1] https://github.com/webcomponents/webcomponentsjs#browser-sup...

Chrome and Safari (including iOS) have native support, which also means mobile browser native support is near universal. For Firefox and IE/edge, the v1 polyfill works really well. I’m optimistic these browsers will soon support it natively but until then it works very well today conditionally loading the polyfill for that percentage of browsers w/o native support.

We do this with Stencil, so far so good: http://stenciljs.com/