- From: Chris Lilley <chris@w3.org>
- Date: Thu, 15 Feb 2007 03:35:45 +0100
- To: T Rowley <tor@cs.brown.edu>
- Cc: www-svg <www-svg@w3.org>
On Wednesday, February 14, 2007, 10:14:41 PM, T wrote:
TR> We're currently fixing <a> to work inside <text> for Mozilla/Firefox,
Good. I saw that FF3 Gran Paradiso now has a native implementation of
linking. I'm very pleased by the improvements in this new alpha, both
spec coverage and speed/memory use.
TR> and have run across a couple oddities that appear allowed by the DTD in
TR> SVG 1.1, but are a bit strange.
TR> Here's a testcase showing three uses of <a> inside <text> - first normal
TR> usage, then setting the "transform" attribute of <a>, and then adding an
TR> ordinary geometry object inside the <a>.
TR> <svg xmlns="http://www.w3.org/2000/svg">
TR> <g font-size="25">
TR> <text y="25">test1(1)<a>test1(2)</a></text>
TR> <text y="75">test2(1)<a
TR> transform="translate(0,25)">test2(2)</a></text>
TR> <text y="125">test3<a><circle cx="150" cy="200" r="50"/></a></text>
TR> </g>
TR> </svg>
TR> Firefox (with a patch I'm currently reviewing) and Opera show "test2(2)"
TR> offset vertically and the circle. Batik and ASV3 ignore the transform
TR> and circle. Webkit doesn't show content for any of the <a>s.
Test 2 is correct.
Test 3 is unfortunately not forbidden by the DTD, mainly because DTDs
suck. (HTML has the same problem - if you have an invalid document
where a foo is not allowed inside a bar, you can mostly make it DTD
valid by wrapping the foo in <a href="whatever"> </a> because the
content model for the a element is very loose).
We fixed that in SVG 1.2 by using RelaxNG. The content model of an a
element is now context dependent - its the content model of its parent
element. Which prevents you putting circles inside text or, indeed,
tspans inside groups, just by hiding them inside a link.
TR> A search through the Text and Linking chapters of the SVG 1.1 spec
TR> doesn't appear anything that forbids the markup in test2/3.
I agree that the prose could indicate that this content model loophole
should not be exploited. But its not forbidden, and your rendering
seems to be correct.
Oh - while you are implementing, here is another test
<text y="175">Smaller
<a x:href="f1">and smaller
<a x:href="f2">like Russian</a>
dolls,</a>
nesting in test4.
</text>
SVG allows nested links; the innermost link wins in the case of
overlapping links. I just mention that in case it affects the way your
implementation finds which link to activate.
--
Chris Lilley mailto:chris@w3.org
Interaction Domain Leader
Co-Chair, W3C SVG Working Group
W3C Graphics Activity Lead
Co-Chair, W3C Hypertext CG
Received on Thursday, 15 February 2007 02:35:59 UTC