0

Would HTML data attributes not enable developers to target a subset of the DOM? In terms of CSS's ability to target all <div>'s, doesn't the more specific selector (the one that says [data-role="widget"]) win?

Javascript has modular pattern design available.

Why do we need a shadow DOM?

Ronnie Royston
  • 16,778
  • 6
  • 77
  • 91
  • The Shadow DOM is not a way to target a subset of the DOM. – Oriol May 14 '16 at 20:05
  • Though I think this question is low quality, possibly duplicate and possibly offtopic I try to put it short: Web Components is more than custom tags. They encapsulate whole dom trees, logic with public interface and stylesheets in a registered component. It would look like the stylesheet defines and provide a defined interaction. Think of custom drop down or flyout menus, toggle buttons or even form components that should have a micro business logic. Web Components will encapsulate them, expose it as `` and provide a `flyout.open();` the programmer internally implemented. – try-catch-finally May 14 '16 at 20:07
  • @try-catch-finally I don't think the Shadow DOM does all that. Web Components do. ...Web components seem to violate the KISS principle. – Ronnie Royston May 14 '16 at 20:59

0 Answers0