Re: [css3-selectors] Default namespace and implied universal selector

On Apr 21, 2011, at 3:30 AM, Allan Sandfeld Jensen <kde@carewolf.com> wrote:

> Hello 
> 
> I have a comment/request for clarification to the default namespace rule 
> effect CSS selectors, that recently bothered me. I am not sure if it belongs 
> only in CSS Selector Level 3 specification or is also relevant to the CSS 
> namespace specification.
> 
> The question is if the implied universal selector in the presence of a default 
> namespace, like an explicit universal selector should be interpreted as ns|*.
> I personally believe this is the case, but could find no text explicitly 
> stating that.

Yes, it should be. 

> 
> It is stated that the universal selector without a namespace part should be 
> treated as ns|* if a default namespace has been declared, and it is later 
> stated that the universal selector can be omitted if there is more than one 
> simple selector in a simple selector sequence. It is however not clear if the 
> later statement that the universal selector can be omited, is a requirement 
> meaning implied and explicit universal should always be treated identical, or 
> if it is just an observation. In general the namespace rules seems kind of 
> 'tacked on' and not really integrated into the text.
> 
> The difference becomes more important when it is later stated that the default 
> namespace does not affect attribute-selectors, but in a sense they do if the 
> attribute selector stands alone. For instance: [attr], in the presence of a 
> default namespace means select elements with types in the default namespace if 
> they have an attribute 'attr' in the empty namespace.

A default namespace rule affects all type selectors, explicit or implied. It only has no effect if there is an explicit namespace on the selector (including a null namespace). It just doesn't affect attribute themselves. 

> 
> Am I reading the spec correctly, and could the consequences of default 
> namespace on implied universal selectors be made more clear?
> 
> Best regards
> `Allan
> 

Received on Thursday, 21 April 2011 23:13:58 UTC