Re: [shadow-styling] clarify role of the `active shadow tree`

>
> Just to make sure - multiple shadow roots can style the host element,
> but they can't style elements in other shadow roots.  Assuming this is
> true, then yeah, this is already implied by the spec.


This is true, except for the following:

:host /shadow/ .foo {...}

This should style all .foo matching elements in all shadowRoots of the host
element.

Again, I believe the spec already says this is so.


On Sat, Mar 15, 2014 at 9:49 AM, Tab Atkins Jr. <jackalmage@gmail.com>wrote:

> On Fri, Mar 14, 2014 at 10:01 AM, Steve Orvell <sorvell@google.com> wrote:
> > This section (http://dev.w3.org/csswg/shadow-styling/#shadow-trees)
> defines
> > the `active shadow tree`, but the spec does not mention the importance
> this
> > has for styling. The spec does say,
> >
> > "The descendants of a shadow host must not generate boxes as normal.
> > Instead, the contents of the active shadow tree generates boxes as if it
> > were the contents of the element instead."
> >
> > It's unclear to me if "generate boxes" is connected with the application
> of
> > a stylesheet. Regardless, the spec needs to clarify the following
> behavior.
>
> This is me hooking into the in-the-process-of-acquiring-spec-language
> concept of the box tree.  Elements generate boxes, which generate
> fragments, which are rendered.  If you don't generate boxes, you don't
> do anything - this is what display:none does.
>
> On Fri, Mar 14, 2014 at 1:00 PM, Steve Orvell <sorvell@google.com> wrote:
> > Upon further reflection, I think it would be better if the `active shadow
> > tree` and the <shadow> element had *no influence* on whether or not a
> > stylesheet applies.
> >
> > Instead, all stylesheets in all sibling shadowRoots should always apply.
>
> This is what the spec currently says, so that's good.  ^_^
>
> > For
> > rules without :host, there would be no detectable change since the styles
> > are still scoped to individual shadowRoots. However, there are
> implications
> > for the :host selector since it reaches up to the host element. In
> > particular, this means if there's a :host rule in an older shadowRoot, it
> > always applies to the host element.
> >
> > I believe 90% of the time, this will be what the author wants. In the
> case
> > where it's not, the onus is on the author to override the :host styling
> in
> > the younger shadowRoot. This seems like a good tradeoff.
>
> Just to make sure - multiple shadow roots can style the host element,
> but they can't style elements in other shadow roots.  Assuming this is
> true, then yeah, this is already implied by the spec.
>
> ~TJ
>

Received on Monday, 17 March 2014 15:31:06 UTC