Join GitHub today
Shadow DOM: Contentious Bits
A. Multiple Shadow Roots per Element
Current state: removal being discussed
- enables consistent story for adding shadow trees to builtins
- provides reasoning about subclassing DOM trees
- complexity: (link to trac.webkit.org patch removing the code?)
- performance: may result in "submerged" trees that aren't rendered but still participate in style/layout
Cost/benefit of change:
- Disables the use case for general inheritance-based component composition and Firefox UI in XBL)
- Makes implementing Shadow DOM easier
- add imperative equivalent, the ability to transfer a shadow tree from one host to another.
- Ryosuke/Ted/Jan Proposal
B. The default value of "closed shadow tree" flag
Current state: in need of consensus, currently spec'd as open-by-default, with strong opposition to flip to closed-by-default.
Spec bug: The default value of open/closed flag
- offers enough of a doorstep to avoid unintentional wandering across composition boundaries.
- compatible with most of today's tooling/testing/introspection techniques in the wild
- developers are likely to ignore the doorstep in cases where they "just need stuff done", and thus negatively affect component's composition qualities (robustness, maintainability, reuse).
- provides a more explicit barrier to prevent deliberate access (though not actively hostile attempts at gaining entry)
- ensures that the internal structure of the component is never part of the contract between component user and component developer
- forces component testing to use different code from what is shipping (no way to test the inside of the component instance)
- disables a class of introspection tooling (example: design-mode introspection in a drag/drop designer) and checkers (example: accessibility checker)
- breaks event delegation
- Don't have the default value. Make developer choose their mode when creating a shadow root.
Feedback from Web Developers:
C. The imperative distribution API
Current state: needs working proposal
- Enables more flexible ways to select content into insertion points.
- Imperative API that explains the declarative
<content>element's magic is good for the platform.
- There are several proposals, each with its own weaknesses, with no clear winner.
- There are several possible workarounds, but they do not satisfy the web components gold standard's content reprojection criteria.
D. Separate Event Retargeting from Style Composition
Current state: being considered
Spec bug: Make event retargeting optional
- Smaller primitives make implementation easier
- Event retargeting is still necessary for closed shadow trees.
E. Shadow boundary-piercing combinators
Current state: being considered for removal
- Provides somewhat mechanical workaround for existing CSS theming frameworks
- Empowers widget consumers to tweak pre-developed widgets
- Provides UA stylesheet equivalent.
- Third-party theming anti-pattern
- Developers are tempted to put everything into their "UA stylesheet equivalent"
- Contributes negatively to potential performance opportunities.