W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2008

getComputedStyle results

From: Joćo Eiras <joao.eiras@gmail.com>
Date: Mon, 31 Mar 2008 02:21:15 +0100
To: "www-dom@w3.org" <www-dom@w3.org>
Message-ID: <op.t8uwppbqjz3wb9@foobar.wag54gs>


The spec for getComputedStyle says the following:
  > Return Value, CSSStyleDeclaration, The computed style. The  
CSSStyleDeclaration is read-only and contains only absolute values.

A broad description for absolute (or used) value can be found here
  > http://www.w3.org/TR/CSS21/cascade.html#used-value

Now, the problem is that the absolute value description is too generic,  
and currently browsers return different results for different properties,  
when calling getComputedStyle. Like:
  - Mozilla and Safari retuns rgb(n,n,n) for colors while Opera returns  
#rrggbb (imo, Safari copied Moz just for the sake of market share)
  - Mozilla many times retuns auto for many dimensions properties like  
height, width, top,left... while Opera returns always proper pixel  
  - Mozilla and Safari sometimes return keywords for quantitative  
properties like font-weight. By default getComputesTyle returns "normal"  
for these browsers, while Opera returns a numeric value (normal computes  
to 700).

So, we need the spec to detail how colors, dimensions and other properties  
should be represented when returned by getComputedStyle. IMO, Opera's  
implementation is more useful. Having keywords for quantitative properties  
is useles, you can't do arithmetics with them.

But these are use cases where we need to get the current applied cascaded  
styles, not absolute ones. How can we get this kind of information? Does  
getOverrideStyle fit this profile ?

Thank you.
Received on Monday, 31 March 2008 01:21:52 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:13 UTC