W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2009

Re: [selectors-api] SVG WG Review of Selectors API

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Wed, 28 Jan 2009 11:40:25 -0500
Message-ID: <49808A79.2010800@mit.edu>
To: Giovanni Campagna <scampa.giovanni@gmail.com>
CC: public-webapps@w3.org

Giovanni Campagna wrote:
> 2009/1/28 Boris Zbarsky <bzbarsky@mit.edu>:
>> Giovanni Campagna wrote:
>>> well, assuming that an author will need to match elements across
>>> multiple namespaces, it will be easier to use XPath (that also is
>>> compatible across multiple browsers) than to use horrible workarounds
>>> like "svg :not(foreignObject) *[href]" (all svg links)
>> I should note that that selector doesn't actually work to select things that
>> are not inside a foreignObject...  Offhand, I see no way to do that, in
>> fact.
> Why shouldn't it?

   <svg xmlns="http://www.w3.org/2000/svg">
     <g>
       <foreignObject>
         <foo xmlns="" href="This is my random href attribute"/>
       </foreignObject>
     </g>
   </svg>

The <foo> element matches the "svg :not(foreignObject) *[href]" 
selector.  Indeed, "*[href]" matches the <foo> element, 
":not(foreignObject)" matches the <g>, and "svg" matches the <svg>.

> It is the summary of the email Lachlan linked, with pros and cons of
> various solutions.

Oh, ok.  So that was just reiterating what had already been said.  Gotcha.

> It is not only SVG, it is any markup language that may be mixed to
> build a compound document.

There is a lot less of a problem with languages that don't have 
colliding localNames.

-Boris
Received on Wednesday, 28 January 2009 16:41:09 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:29 GMT