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

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 UTC