W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2015

Re: :host pseudo-class

From: Anne van Kesteren <annevk@annevk.nl>
Date: Mon, 27 Apr 2015 10:06:13 +0200
Message-ID: <CADnb78ignvL9kKfa-sfxPOu0mMSzfrZLBw9Qastq_Tz=J6aKWA@mail.gmail.com>
To: Rune Lillesveen <rune@opera.com>
Cc: "L. David Baron" <dbaron@dbaron.org>, "www-style@w3.org" <www-style@w3.org>, WebApps WG <public-webapps@w3.org>
On Mon, Apr 27, 2015 at 9:03 AM, Rune Lillesveen <rune@opera.com> wrote:
> On Mon, Apr 27, 2015 at 6:22 AM, Anne van Kesteren <annevk@annevk.nl> wrote:
>> Would they match against elements in the host's tree or the shadow
>> tree? I don't see anything in the specification about this.
>
> They would match elements in the shadow tree.
>
> A typical use case is to style elements in the shadow tree based on
> its host's attributes:
>
> <my-custom-element disabled>
>     <custom-child></custom-child>
> </my-custom-element>
>
> In the shadow tree for <my-custom-element>:
>
> <style>
>     :host([disabled]) ::content custom-child { color: #444 }
>     :host([disabled]) input { border-color: #ccc }
> </style>
> <content></content>
> <input type=text>

Thanks, that example has another confusing bit, ::content. As far as I
can tell ::content is not actually an element that ends up in the
tree. It would make more sense for that to be a named-combinator of
sorts. (And given ::content allowing selectors on the right hand, it's
now yet more unclear why :host is not ::host.)


-- 
https://annevankesteren.nl/
Received on Monday, 27 April 2015 08:06:38 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:27:31 UTC