W3C home > Mailing lists > Public > www-style@w3.org > February 2014

Re: [shadow-styling] alternative idea.

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 10 Feb 2014 10:52:25 -0800
Message-ID: <CAAWBYDCOhE_5fWso9zRiNWRCv8QSVFiV7B6RB_CoTicbTsVO8Q@mail.gmail.com>
To: Andrew Fedoniouk <news@terrainformatica.com>
Cc: "www-style@w3.org" <www-style@w3.org>
On Sun, Feb 9, 2014 at 7:09 PM, Andrew Fedoniouk
<news@terrainformatica.com> wrote:
> On Sun, Feb 9, 2014 at 4:14 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
>> On Sat, Feb 8, 2014 at 3:37 PM, Andrew Fedoniouk
>> <news@terrainformatica.com> wrote:
>>> (as an alternative to this: http://dev.w3.org/csswg/shadow-styling/)
>>>
>>> Let's imagine that we have @-rule named @shadow that defines block of
>>> rules applied to the shadow tree of some element:
>>>
>>> @shadow dropdown-select {
>>
>> This was actually the very first thing we tried with Shadow DOM
>> styling, at least two years ago.  At-rules seemed like the the most
>> natural context-switcher.

As further justification for rejecting this, the WG as a whole has
moved away from using at-rules as a selector context-switcher.
@region was an early attempt at this as well, and we decided not to do
it.

>> It ended up being *super* confusing to actually use, particularly when
>> you needed to switch contexts again into the <content>-distributed
>> stuff.
>
> Not clear, could you elaborate more on that? What does it mean
> "switch contexts again into the <content>-distributed stuff"?

Are you very familiar with Shadow DOM?  If not, go check it out:
<http://w3c.github.io/webcomponents/explainer/#insertion-points>

> Is it close to
> select[size=1] { shadow: intrinsic; /*or something like that*/  }
> ?

No, it's nothing like that, because I have no idea what this is
supposed to mean. ^_^

>> Just using normal selectors ends up working way better; it just makes
>> more *sense* to people in practice, we've found.
>>
>
> Here are my assumptions I used before implementing style sets :
>
> 1. Most of the time shadow DOM styling is about widgets
>     like input[various],select,etc.

Yes, many/most uses of Shadow DOM are within the context of Web
Components, or custom libraries doing similar things.

> 2. Most of the time set of shadow styles  needs to be applied
>     as a whole: either all rules or none of them. E.g. changing
>     style of select -> caption without updating select -> button
>     does not really work. Those styles are tightly bound.

Not at all.  It absolutely makes sense to update small bits of a
component rather than all of them at once.

> 3. Any form of shadow DOM styling shall not increase
>     complexity of overall style resolution.
>
> 4. Selector specificity on shadow DOM is different
>     from normal flat CSS rule space.

Shadow DOM specificity is similar to how scoped style specificity works.

> As soon as you will allow shadow dom styling expect
> bunch of rules like these:
>
> body[theme=blue] input[type=date] -> table th.weekday { color:blue }
> body[theme=blue] input[type=date] -> table td.today { background:blue }
> body[theme=blue] input[type=date]:focus -> table td.today { background:red }
> ...

I have no idea what these mean.  Are you using some weird custom
syntax?  Is "->" supposed to mean "/shadow-all" or something?

~TJ
Received on Monday, 10 February 2014 18:53:14 UTC

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