- From: Brian Birtles <bbirtles@mozilla.com>
- Date: Fri, 17 Apr 2015 11:25:43 +0900
- To: 'www-svg' <www-svg@w3.org>
Hi,
I made some edits to deprecate xlink:href. The behavior when using the
IDL attribute, however, probably needs work.
Originally I thought, the following should continue to work:
<image xlink:href="abc.png">
<set attributeName="xlink:href" to="def.png"/>
</image>
image.getAttribute("href"); // ""
image.getAttributeNS("http://www.w3.org/1999/xlink",
"href"); // "abc.png"
image.href.baseVal // "abc.png"
image.href.animVal // "def.png"
So I specced the behavior of the IDL attribute so that it returns a
SVGAnimatedString object which corresponds to either 'href' or
'xlink:href' depending on which was in use at the time the attribute was
accessed (but preferring href if both were in use).[1]
On further thought, I think I should probably change that so that 'href'
always returns the same SVGAnimatedString object and there's a single
animVal regardless of whether you animate 'xlink:href' or 'href'. That
is, the following two declarations target the same value:
<set attributeName="xlink:href" to="1.png"/>
<set attributeName="href" to="2.png"/>
Here the usual SMIL override rules apply (in this case the second
declaration wins since they have the same start time and no syncbase
dependencies so document order it used). I don't think we should
complicate the sandwich model any further so that, for example, the
'href' version in the following wins:
<set attributeName="href" to="2.png"/>
<set attributeName="xlink:href" to="1.png"/>
The baseVal member would return 'xlink:href' if set and 'href' was not
set, otherwise 'href'. i.e. Only the baseVal member switches.
Setting the baseVal member sets whatever attribute it would read from
(i.e. 'href' unless 'xlink:href' was already set and 'href' was not).
Since strings aren't additive for animation we don't need to worry about
where the animation gets its underlying value from.
Essentially you'd have a somewhat special SVGAnimatedString but I think
this is probably better.
Let me know if you have any suggestions, otherwise I'll go ahead and
spec something along these lines.
Best regards,
Brian
[1] https://svgwg.org/svg2-draft/types.html#InterfaceSVGURIReference
Received on Friday, 17 April 2015 02:26:13 UTC