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

On Tue, 3 Jan 2006, Jeff Schiller wrote:
> 
> <g xml:id="button" fill="rgb(200,0,0)">
>   <rect xml:id="shadow" x="7" y="7" width="5" height="5" fill="grey" />
>   <rect xml:id="buttonSurface" fill="inherit" x="5" y="5" width="5" height="5"/>
> </g>
> 
> With uDOM:
> 
> function highlightButton(bHighlight) {
>   var nHighlight = (bHighlight ? : 20 : -20);
>   var ele = document.getElementById("buttonSurface");
>   var color = ele.getRGBColorTraitNS(null, "fill");
>   color.red += nHighlight;
>   color.green += nHighlight;
>   color.blue += nHighlight;
>   ele.setRGBColorTraitNS(null, "fill", color);
> }
> 
> With existing DOM:

   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) + ')');
   }

(There are plans for making big improvements to the CSSOM which would 
reduce this to:

   function highlightButton(bHighlight) {
     var nHighlight = (bHighlight ? : 20 : -20);
     var ele = document.getElementById("buttonSurface");
     var color = ele.runtimeStyle.color;
     color.red += nHighlight;
     color.green += nHighlight;
     color.blue += nHighlight;
   }

...but they have not been specced out yet.)

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Tuesday, 3 January 2006 18:42:22 UTC