[shadow-styling] /content/ is cumbersome v. ::content

Let's say an author wants to style all `div`'s within the subtree selected
to a given insertion point. Correct me if I'm wrong, but it seems like this
selector would be required:

content /content/ div, content /content/ * div { ...}

This is based on the definition of the /content/ combinator here:
http://dev.w3.org/csswg/shadow-styling/#content-combinator.

Previously, the ShadowDOM spec defined a pseudo-element ::content for
matching the content element. With this pseudo-element, to write a selector
which matched the same set of elements would have been:

::content div { ... }

This is certainly a win for brevity.

If it's important to restrict a selector to the set of distributed
elements, you can use the child combinator. In other words, these would be
equivalent:

content /content/ div { ... }
::content > div { ... }

This makes me think a pseudo-element would be superior for matching
distributed elements.

Are there other reasons to prefer a combinator?

Received on Monday, 17 March 2014 21:24:31 UTC