W3C home > Mailing lists > Public > www-svg@w3.org > January 2006

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

From: Ian Hickson <ian@hixie.ch>
Date: Tue, 3 Jan 2006 18:37:02 +0000 (UTC)
To: Jeff Schiller <codedread@gmail.com>
Cc: www-svg@w3.org
Message-ID: <Pine.LNX.4.62.0601031824590.2856@dhalsim.dreamhost.com>

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 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:33 GMT