W3C home > Mailing lists > Public > www-style@w3.org > April 2015

[css-scoping] Was shadow host intended to be more feature-less than "featureless"?

From: L. David Baron <dbaron@dbaron.org>
Date: Tue, 7 Apr 2015 13:12:06 -0700
To: www-style@w3.org
Message-ID: <20150407201206.GA23793@pescadero.dbaron.org>
http://dev.w3.org/csswg/selectors-4/#featureless says:
  # Individual featureless elements may define additional
  # restrictions on what kinds of selectors can match them.
  #
  # EXAMPLE 3
  # For example, the host element in a shadow tree is featureless,
  # and can’t be matched by any pseudo-class except for :host and
  # :host-context().) 

http://dev.w3.org/csswg/css-scoping-1/#host-element-in-tree also
says in a note:
  # So, to allow this situation but prevent accidental styling, the
  # host element appears but is completely featureless and
  # unselectable except through :host.

This makes it appear that it was clearly intended that the host
element never match selectors other than :host, :host(), and
:host-context().

However, I don't see anything in the spec that makes this be the
case.  http://dev.w3.org/csswg/css-scoping-1/#host-element-in-tree
defines the host element to be featureless, which means that it
doesn't match tag selectors, class selectors, id selectors, or
attribute selectors.  However, it still seems like the shadow host
would match pseudo-classes like :hover, and also negated
pseudo-classes like :not(:hover).

It seems like the spec intends to make the shadow host not
"accidentally" match selectors like :hover or :not(:hover) so that
such selectors don't accidentally match outside of the shadow tree.
However, it's not clear to me what mechanism the spec intends to
make that happen.

(It also seems like the "featureless" concept is perhaps more
complicated than needed and doesn't quite solve the problem it was
intended to solve, since it doesn't actually solve the problem with
:not() accidentally matching outside of the shadow tree.)

(I ask because William's patch to implement :host-context() in
https://bugzilla.mozilla.org/show_bug.cgi?id=1082060 appears to
me to violate the spec, but it also seems like the behavior he's
implementing may be better than what the spec says, but also might
end up differing from what it eventually says in subtle but
complicated-to-fix ways.)

-David

-- 
π„ž   L. David Baron                         http://dbaron.org/   𝄂
𝄒   Mozilla                          https://www.mozilla.org/   𝄂
             Before I built a wall I'd ask to know
             What I was walling in or walling out,
             And to whom I was like to give offense.
               - Robert Frost, Mending Wall (1914)

Received on Tuesday, 7 April 2015 20:12:32 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:30 UTC