W3C home > Mailing lists > Public > www-style@w3.org > August 2013

Re: [selectors4] Comma-separated attribute value selectors

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 19 Aug 2013 14:00:20 -0700
Message-ID: <CAAWBYDDhhwoUOJTNv-gAiRfoRfgUAk6-1H6iEwA9bfjAo6bwJg@mail.gmail.com>
To: Simon Sapin <simon.sapin@exyr.org>
Cc: www-style list <www-style@w3.org>
On Mon, Aug 19, 2013 at 11:57 AM, Simon Sapin <simon.sapin@exyr.org> wrote:
> Le 19/08/2013 19:51, fantasai a écrit :
>
>> There's an issue in the Selectors spec [1] on adding comma-separated
>> values
>> to the attribute selectors, as syntactic sugar, e.g.
>>
>>     [rel=next,prev] { ... }
>>
>> [1] http://www.w3.org/TR/2013/WD-selectors4-20130502/#attribute-selectors
>>
>> This seems pretty straightforward and desirable to me. Does anyone think
>> we *shouldn't* add this? 'Cuz otherwise I think we should add it. :)
>
>
> I assume this is equivalent to :matches([rel=next], [rel=prev]) ? Yes, that
> would be nice to have, and seems easy enough to implement (given support for
> :matches().)

Yes, that's the right equivalency.

fantasai's suggesting this because we just ran into a great use-case
today while adjusting the spec stylesheet:

[data-link-type="property"]::before,
[data-link-type="propdesc"]::before,
[data-link-type="descriptor"]::before,
[data-link-type="value"]::before,
[data-link-type="function"]::before,
[data-link-type="at-rule"]::before,
[data-link-type="selector"]::before,
[data-link-type="maybe"]::before {content: "\2018";}
[data-link-type="property"]::after,
[data-link-type="propdesc"]::after,
[data-link-type="descriptor"]::after,
[data-link-type="value"]::after,
[data-link-type="function"]::after,
[data-link-type="at-rule"]::after,
[data-link-type="selector"]::after,
[data-link-type="maybe"]::after {content: "\2019";}

Which could instead be written as:

[data-link-type=property, propdesc, descriptor, value, function,
at-rule, selector, maybe]::before { content: "\2018"; }
[data-link-type=property, propdesc, descriptor, value, function,
at-rule, selector, maybe]::after { content: "\2019"; }

:matches() would make this slightly better, but not a ton, because
you'd need to repeat the attribute name multiple times.

~TJ
Received on Monday, 19 August 2013 21:01:07 UTC

This archive was generated by hypermail 2.3.1 : Monday, 19 August 2013 21:01:07 UTC