W3C home > Mailing lists > Public > www-style@w3.org > April 2008

Re: [attr|=""] Selector

From: fantasai <fantasai.lists@inkedblade.net>
Date: Wed, 02 Apr 2008 13:49:03 -0700
Message-ID: <47F3F13F.7040403@inkedblade.net>
To: Bert Bos <bert@w3.org>
CC: www-style@w3.org

Bert Bos wrote:
> 
>> Given this definition of |= there is no ambiguity about whether
>> [attr|=""] matches a given attribute. None.
> 
> To a programmer, maybe: [foo|=""] matches foo="-bar", because the value 
> starts with an empty string immediately followed by a dash. But that's 
> the same for ^=, which is defined as:
> 
>     Represents an element with the att attribute whose value begins
>     with the prefix "val".
> 
> So clearly [foo^=""] matches foo="bar", because "" is a prefix of every 
> string. And yet we decided that it was *not* clear, and indeed was not 
> the case.
> 
> I don't care whether the empty string matches everything or nothing 
> (although I suspect that most people will not consider the empty string 
> to be a prefix of anything), but I think we should be consistent.

In the case of [attr|=""] a literal interpretation of the wording would
not match everything, nor would it match nothing. It matches a very
specific subset of values. For the other selectors, ~=, *=, ^=, $=, the
choice is between everything and nothing, and there we decided to be
consistent with ~= and match nothing.

~fantasai
Received on Wednesday, 2 April 2008 20:49:38 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:03 GMT