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

Giovanni Campagna wrote:
> 2009/1/28 Boris Zbarsky <bzbarsky@mit.edu>:
>>  <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>.
> 
> One point in favour of namespace support then!

The purely technical limitations are already well understood.  This in 
itself is not a point in favour of introducing namespaces.  The above 
problem occurs with any other kind of selector using :not() in the 
sequence, wanting a way to filter out a specific element from the 
ancestor chain.  It's not just a namespace related limitation.  The 
issue remains the lack of clear use cases demonstrating *why* the 
problem should be solved.  That is, why should we address that 
particular technical limitation above?

>> 1. Why is the author mixing SVG and, presumably, HTML in this case?  I know
>> there are use cases for this in general, but we should be specific about
>> which.
> 
> Because SVG allows for greater presentation than HTML and CSS, but
> this greater presentation only applies to a small part of the
> document. Or because I have two versions of the same page, one in SVG
> and one in HTML, switched by CSS and media queries or JS.

This is not a use case.  They're technical reasons for choosing SVG as 
the solution to some particular use case or problem.  What is the 
specific use case that is being addressed?

For example, this is a hypothetical use case I've made up to demonstrate 
what I'm looking for.  (Of course, I would expect any real use case to 
not simply be made up like this one, but rather based on something real 
world authors would want to do, ideally supported by real world examples.)

---

A city rail transport website wants to provide a map of the rail 
network.  The map is drawn in a diagram style, just like the London Tube 
map.  The map user needs to be able to zoom in and scale the map easily, 
and clicking on a station on the provides more information about that 
station and the lines that pass through it.

SVG is being used because it's scalable and scripts can be used to scale 
it easily as the user zooms in.  The linking abilities also allow the 
user to click on a station, and the solution is deemed to be better than 
the alternative using a PNG and an image map.

---

>> 2. Why does the SVG contain links?  This may be partially answered by the
>> previous question.  Preumably this means that it's not meant as a purely
>> decorative image and the links provide the user with something useful.
> 
> Because SVG links follow the SVG rendering model: they're positioned, 
> stroked, alpha blended, animated. Instead HTML links are flowed and 
> follow the CSS rendering model. Only their container (foreignObject) 
> is part of the SVG image. Either you put an foreignObject for each 
> link, or you don't use HTML links.

Again, this does not answer the question of what the links are being 
used for.  It just provides more technical details about the solution.

However, note that the above example use case I provided answers both 
the first and second questions clearly by itself.  It does not, however, 
answer the third or fourth.  (If I knew of some use cases that answered 
those questions, we wouldn't be having this discussion)

>> 3. Why does the SVG image contain links using elements from a foreign
>> namespace in addition to links using elements from its own namespace?
> 
> As I said earlier, SVG links are different from HTML links in that
> HTML is flowed. If I want to have a rich user interface with animating
> buttons on the top of my SVG, but I want to have some HTML content in
> the same image, I need HTML links.

This does not explain why the image would use SVG elements for some 
links and HTML elemenets for others within the same image.  As far as I 
can tell, the above use case I provided doesn't need to use HTML links 
at all, so it's probably not one that is suitable for answering the 
questions I asked you, nor providing justification for adding namespace 
support.  However, I only provided it for illustrative purposes to show 
what a use case is.  It's the responsibility of you and others who are 
pushing for the namespace feature to present real use cases, not mine.

>> 4. What is the author trying to achieve using a script that needs to obtain
>> those links, and why does it only affect links from the SVG namespace, and
>> not all links within the SVG image, including those from other namespaces
>> within <foreignObject>?
> 
> As I said before, scripting may need those for imperative animation, 
> usually more powerful (but less performant) than declarative one. It 
> may need only SVG links because SVG links are completely different 
> than HTML links. Setting a strokeColor CSS property on HTML link has 
> no effect.

In that case, if there are no HTML links within the image, what problem 
would a namespace resolution feature solve?

>> If you can think of any other questions, feel free to ask them and answer
>> them.  The more information we have about the use cases, the easier it will
>> be to evaluate them and find an appropriate solution.
> 
> This is was not a complete use case, it was just an example.

Well, it's use cases that are needed, not just simple examples that are 
trivial to make up.

-- 
Lachlan Hunt - Opera Software
http://lachy.id.au/
http://www.opera.com/

Received on Wednesday, 28 January 2009 23:41:38 UTC