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) or "svg
not(timesheet) animation" (all SVG but not SMIL animations), or
"select[bind], select[ref]" (xforms selects)
I think that those example are even easier to rewrite as
"svg|*[href]", "svg|animation", "xforms|select", provided a reliable
namespace binding mechanisms (the one I proposed)
The use case should try to answer the following questions. Try to be as
specific and realistic as possible, and provide links to real world
examples if you can.
Let's go with the first example you gave of selecting all SVG links:
"svg :not(foreignObject) *[href]".
Note that the example selector provided won't actually work to select
all SVG links, at least not in the general case. The only way that
could work is like this:
"svg>:not(foreignObject)>[href],
svg>:not(foreignObject)>:not(foreignObject)>[href],
svg>:not(foreignObject)>:not(foreignObject)>:not(foreignObject)>[href],
..."
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.
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.
3. Why does the SVG image contain links using elements from a foreign
namespace in addition to links using elements from its own namespace?
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>?
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.
--
Lachlan Hunt - Opera Software
http://lachy.id.au/
http://www.opera.com/