W3C home > Mailing lists > Public > www-style@w3.org > October 2011

Re: [Selectors4] Another interpretation of [att~=val] when val contains space

From: fantasai <fantasai.lists@inkedblade.net>
Date: Mon, 10 Oct 2011 10:58:55 -0700
Message-ID: <4E93325F.5060603@inkedblade.net>
To: "Kang-Hao (Kenny) Lu" <kennyluck@w3.org>
CC: WWW Style <www-style@w3.org>, John Hax <johnhax@gmail.com>
On 03/10/2011 09:25 PM, Kang-Hao (Kenny) Lu wrote:
> (On courtesy of John Hax's proposal[1])
> I think this should have been proposed before, but I'll post it again in
> case it hasn't.
> Currently, for [att~=val], the selectors spec says:
> [[ If "val" contains whitespace, it will never represent anything (since
> the words are separated by spaces). ]]
> I am wondering whether we can redefine this to be a list of possible
> match. Namely,
> [rel~="a b c d"]
> should represent what is represented by
> :any([rel~=a],[rel~=b],[rel~=c],[rel~=d])
> The use case is something like,
> nav a[rel~="prev next first last up"]::before {
>    border-radius: 4px;
>    background: url(nav-link-bg.png)
> }
> which will be less lengthy than the :any equivalent.
> My personally opinion is that the use case is not strong enough to add a
> hack to the current syntax, but I am curious about what folks in this
> forum think.

I think I agree with your opinion. :) But we could do something like

   [rel~=prev,next,first,last,up]                 /* quotes not needed for idents */
   [rel ~= "prev", "next", "first", "last", "up"] /* if you need/prefer quotes */

That will allow us to use the same notation for other types of attribute
selectors. I'll ask what the WG thinks, and if they agree I'll add it to
the Selectors 4 draft.

Received on Monday, 10 October 2011 21:17:31 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:51 UTC