html5 - Why Shadow DOM when we have iframes? -
i heard of shadow dom seems solve problem of encapsulation in web widget development. dom , css rules encapsulated maintenance. isn't iframes for? problems there iframes made necessary w3c come shadow dom or html5 web components?
iframes use encapsulation objects...
with exception of svg (more on later), today’s web platform offers 1 built-in mechanism isolate 1 chunk of code — , ain’t pretty. yup, talking iframes. encapsulation needs, frames heavy , restrictive.
shadow dom allows provide better , easier encapsulation, creating clone of dom or part of it.
for example imagine build widget (as have) used across websites. widget might affected css on page , horrible, whereas shadow dom not :)
here excellent article on topic:
Comments
Post a Comment