Re: [SVGMobile12] SVGT12-207: Conformance to uDOM

* Ian Hickson wrote:
>   function highlightButton(bHighlight) {
>     var nHighlight = (bHighlight ? : 20 : -20);
>     var ele = document.getElementById("buttonSurface");
>     var color = getComputedStyle(ele, '').getPropertyCSSValue('fill').getRGBColorValue();
>     document.getOverrideStyle(ele, '').setProperty('fill', 'rgb(' + 
>       (color.red + nHighlight) + ', ' +
>       (color.green + nHighlight) + ', ' +
>       (color.blue + nHighlight) + ')');
>   }

In the SVG DOM getComputedStyle is not available on the global object,
and the RGBColor members are CSSPrimitiveValues which you cannot add
integers to, you'd have to use color.red.getFloatValue() and there is
no gurantee that this would have the same effect e.g. if percentages
are used in the computed value of the fill property. The effect is also
quite different from using the setTrait methods since they operate on
the very low XML attribute level, if you have

  <text style="fill:green" ...

there is no way to change that through the setTrait methods unless you
remove the style attribute.
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 

Received on Tuesday, 3 January 2006 18:52:09 UTC