Re: [selectors4] List [xml:lang] and [xmlns] as selectors that do not work in XML

Simon Sapin, Wed, 25 Sep 2013 14:41:51 +0100:
> Le 25/09/2013 12:43, Leif Halvard Silli a écrit :

>> Hence, these rules would not work in a namespace aware XML parser:
>>        [xmlns] { color: green }
>>     [xml:lang] { color: green }
> [xml:lang] 

Sorry, I forgot to escape: [xml\:lang]. So my point still stands: In a 
namespace aware XML parser, then this rule would not work

    [xml\:lang] { color: green } /* escaped the colon. */

> is not valid Selector syntax. You probably want this:

Sorry, but I did not ask for help - I provided feedback to the editors 
of Selectors level 4.

> As to [xmlns], some testing shows that a bare xmlns attribute 
> (defining the default namespace) ends up in the DOM with 
> 'namespaceURI' set to "". I have no idea 
> why.

It is because the browsers follow the specification of for namespaces 
in XML, which says that @xmlns lives in that namespace.

> So the way to select it (though I don’t know why you would want 
> that) is:
>   @namespace xmlns "";
>   [xmlns|xmlns] { color: green }

You don't need to declare prefix. Like the section of Selectors 4 which 
I was quoting says, you could simply do this - which (unlike your 
example) would work in both XML and in HTML:

   [*|xmlns] { color: green}

>> Proposal: Please add a note/info that mentions @xml:foo and @xmlns as
>> examples of common attributes that cannot, when occurring in a XML
>> document, be styled with a simple [att]{} selector. It helps authors to
>> understand the concept if they see an actual, non-theoretical, example.
>> [1]

> I find this @xmlns parsing oddity more confusing than helpful in 
> understanding namespaces.

Well, if it is confusing, then that *too* is a reason to offer 
explanation in the spec.
leif halvard silli

Received on Wednesday, 25 September 2013 17:16:50 UTC