UPDATE: This demo no longer works as createShadowRoot
got replaced with attachShadow
+ shadow roots can only be created on a limited set of elements nowadays.
As designers, we may want to style something in a certain way, but sometimes end up having to go to war with HTML, CSS, and JS to get it done. And even then, the results can be weighty, hacky, and unsemantic. Shadow DOM might be able to save us from that, giving us a fresh place to use whatever HTML we need without exposing that mess to the actual DOM
Yes, that’s just a default <input type="file" />
, pimped using the Shadow DOM and the template
element.
Related: All posts tagged shadow dom here on bram.us, contains some good introductory videos.