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

(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.

[1] (Chinese)
http://lists.w3.org/Archives/Public/public-html-ig-zh/2010Sep/0012

Cheers,
Kenny

Received on Friday, 11 March 2011 05:23:53 UTC