Hi!
The spec for getComputedStyle says the following:
>
http://www.w3.org/TR/DOM-Level-2-Sty
le/css.html#CSS-CSSview-getComputedStyle
> 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
> ht
tp://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
dimensions
- 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.
|