Re: [selectors-nonelement] ::attr(*|localname), ::attr(ns|*), and ::attr(*)

On Mon, Feb 24, 2014 at 5:47 AM, Simon Pieters <simonp@opera.com> wrote:
> On Mon, 24 Feb 2014 14:32:03 +0100, Jirka Kosek <jirka@kosek.cz> wrote:
>> On 24.2.2014 14:01, Simon Pieters wrote:
>>>
>>> I'm not Tab but I think the reasoning is as follows:
>>>
>>> * and foo are equivalent for the namespace part, i.e. same as *|* and
>>> *|foo or ns|* and ns|foo
>>>
>>> hence
>>>
>>> ::attr(*) and ::attr(foo) should also be equivalent for the namespace
>>> part, i.e. same as ::attr(|*) and ::attr(|foo)
>>
>>
>> Aha, so it seems that the following text is ambiguous:
>>
>> "If the prefix is omitted, the selector only matches attributes in no
>> namespace."
>>
>> because it is not clear whether prefix means "ns" or "ns|". Then
>> rewriting grammar into more rules could help:
>>
>>  <namespace-attr> = [ <prefix>? '|' ]? [ <ident> | '*' ]
>>  <prefix>         = [ <ident> | '*' ]
>>
>> Now it is clear that prefix is meant without | and  thus ::attr(foo) and
>> ::attr(|foo) are different -- former select all foo attributes in any
>> (including no) namespace and later only in no namespace.
>
>
> ::attr(foo) selecting all foo attributes in any namespace would be
> inconsistent with the selector [foo] which selects elements with a foo
> attribute in no namespace.

In type selectors, "foo" and "*" are treated differently wrt
namespaces when there's no default namespace.  "foo" is equivalent to
"|foo", but "*" is equivalent to "*|*".

So consistency with attribute selectors is maintained - ::attr(foo)
would select attributes in the null namespace, same as [foo], but
::attr(*) selects all attributes regardless of namespace.

~TJ

Received on Monday, 24 February 2014 21:17:05 UTC