Using Encapsulation for Semantic Markup

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.

Published by Bramus!

Bramus is a frontend web developer from Belgium, working as a Chrome Developer Relations Engineer at Google. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.