On Wednesday, November 17, 2004, 5:55:56 PM, Boris wrote:
BZ> Jim Ley wrote:
>> It complicates scripting - because CSS properties are always higher
>> specificity than attribute properties, it means you have to do
>> setAttributeNS(null,'style','construct a string of all style
>> operties') - this is both slower and more complicated than just setting
>> the stroke-width attribute.
BZ> I'm sorry, but that doesn't seem to be true.
BZ> Per the SVG 1.1 spec [1] (and the SVG 1.2 proposal claims to be simply an
BZ> extension of SVG 1.1 and does not change this part), a UA that has CSS support
BZ> must support the relevant DOM CSS interfaces. So you can do:
BZ> node.style.setProperty("stroke-width", value, "");
Yes
BZ> which is not particularly more complicated than
BZ> node.setAttribute("stroke-width", value);
Note that the latter may not result in any actual change in the stroke
width, if there are any rules affecting that element and setting stroke
width. Any selector at all is higher specificity.
BZ> (and in some UAs may in fact be faster...). Now I won't claim that I know what
BZ> the state of implementation of this functionality is in current SVG UAs....
BZ> (and I would be curious to find out).
BZ> -Boris
BZ> [1] http://w3.org/TR/SVG11/svgdom.html#CSSDOMFeaturesWithCSSSupport
--
Chris Lilley mailto:chris@w3.org
Chair, W3C SVG Working Group
Member, W3C Technical Architecture Group