Re: :host pseudo-class

On Saturday 2015-04-25 09:32 -0700, Anne van Kesteren wrote:
> I don't understand why :host is a pseudo-class rather than a
> pseudo-element. My mental model of a pseudo-class is that it allows
> you to match an element based on a boolean internal slot of that
> element. :host is not that since e.g. * does not match :host as I
> understand it. That seems super weird. Why not just use ::host?
> 
> Copying WebApps since this affects everyone caring about Shadow DOM.

We haven't really used (in the sense of shipping across browsers)
pseudo-elements before for things that are both tree-like (i.e., not
::first-letter, ::first-line, or ::selection) and not leaves of the
tree.  (Gecko doesn't implement any pseudo-elements that can have
other selectors to their right.  I'm not sure if other engines
have.)

I'd be a little worried about ease of implementation, and doing so
without disabling a bunch of selector-related optimizations that
we'd rather have.

At some point we probably do want to have this sort of
pseudo-element, but it's certainly adding an additional dependency
on to this spec.

-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 Monday, 27 April 2015 03:38:03 UTC