Mike Hartington glows about how good and useful the Shadow DOM is:
[Shadow DOM is] actually built on two simple ideas, isolation and location. Need to create a bit of DOM that is isolated from the global scope? Shadow DOM is here to help. Need to specify the exact location of a piece of DOM? Shadow DOMs scope API is what you need!
It can be helpful to think of components that use Shadow DOM as modules for HTML. Markup and styles are isolated to their own DOM tree, and removed from the global context.
Last time we talked about it around here, I showed how Twitter is using it for embedded tweets — which is a pretty awesome use case — and how it can fall back to an iframe. Mike says they polyfill it in unsupported situations.
I suspect isolated styles is the primary selling point for any of the CSS-in-JS approaches, and having wide support for a native implementation of that will eventually take over. But... you have to make use of web components to use this, which means your framework-created components need to be web components. That's totally possible; I just don't see it that often.
Direct Link to Article — Permalink
The post Shadow DOM in Ionic appeared first on CSS-Tricks.
from CSS-Tricks https://ift.tt/2MlYh96
via IFTTT
No comments:
Post a Comment