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

Hi,

This email is about three separate, but related issues.

The current ED defines:

> ::attr() = ::attr( <qualified-name> )
>
> Where <qualified-name> is a CSS qualified name.

With "CSS qualified name" a link to the css-namespaces spec.

css-namespaces defines <qname> and <wqname> grammar terms. Only the 
latter allows a wildcard for the namespace prefix: `*|localname`. 
selectors-nonelement should clarify which one is intended.

The best way to do this IMO is to not define a new <qualified-name> 
grammar term, but use one of <qname> or <wqname> directly, specifying 
that it is defined in css-namespaces.


----

In http://lists.w3.org/Archives/Public/www-style/2014Feb/0546.html, 
Jirka Kosek said:
> You can select all attributes by ::attr(*)

According to the current ED you can not. `*` matches none of <qname>, 
<wqname>, or "CSS qualified name".

If the intent is to allow this, selectors-nonelement needs additional 
spec text, similar to how type selectors and universal selectors are 
defined separately.


----

Also, it’s not clear that ::attr(*) selects all attributes rather than 
just attributes that are in no namespace.

css-namespaces defines:
> The prefix of a qualified name may be omitted to indicate that the
> name belongs to no namespace, i.e. that the namespace name part of
> the expanded name has no value.

So the "default" behavior of ::attr(foo) and ::attr(*), with the prefix 
omitted, is to select attributes in no namespace.

If this is not the intended behavior, selectors-nonelement needs spec 
text to override it, like Selectors does for type and universal 
selectors (where an omitted prefix means the default namespace if there 
is one declared, or *any* namespace otherwise.)

Note that attribute selectors like [foo] do *not* override this default 
behavior. (Eg. [href] does not match <svg:a xlink:href="…">)

-- 
Simon Sapin

Received on Tuesday, 18 February 2014 10:36:25 UTC