Re: does <set> add an attribute to node.attributes

On 10/18/10 8:17 AM, Jeremie Patonnier wrote:
> It seams that for some of you, there is a difference between <rect
> /> and <rect x="0" y="0" width="0" height="0" />. For end users like
> me, there is not. And at some point, there is no difference in
> browsers as well. In fact, it's a bit tricky (and confusing for
> people like me).

There are no differences for purposes of rendering the SVG, because SVG
defines what values to use in the rendering path if the attributes
aren't set.

But there are differences in terms of what Core DOM APIs like 
getAttribute return, in terms of what CSS selectors match (and note that 
for CSS selector matching all of x="0", x=" 0 ", x="00" are also 
different), and so forth.

> So, accessing the attribute value through the attribute property or
> through the getAttribute method doesn't work in the first case.

Right, since it's not in the DOM.

> when you try to make a direct access to the attributes with the
> syntax rect.width (which is a valid DOM access for what I know)

It's access to a property defined in the SVG DOM.  What it does is just 
defined by the SVG specification.

Similarly, in HTML accessing .width on an image element will sometimes 
return the value of the "width" attribute and sometimes not, depending 
on what else is going on.

> So if there a SVGAnimatedLength object somewhere, it's seams
> obviously possible to animate an attribute which is not declare by
> the user in the first place...

That seems to be the position of everyone except Alex, I think.... ;)

-Boris

Received on Monday, 18 October 2010 16:10:31 UTC