Re: What is getComputedStyle supposed to be for?

Thanks for responding but I'm not sure you answered my main question.  I see
getComputedStyle being suggested as the standards based answer to the
offset* properties in IE and I'm not sure that this is true.  Is
getComputedStyle intended to be used by people building dynamic web pages or
did it have another purpose in mind?

I took a look at the CSS3 specification today to see if it had an expanded
description of this and came up with another question.

In section 4.2 of the Values and Units module it says:

"Relative values, on the other hand, must be transformed into computed
values: percentages must be multiplied by a reference value (each property
defines which value that is), values with relative units (em, ex, px) must
be made absolute by multiplying with the appropriate font or pixel size,
'auto' values must be computed by the formulas given with each property,
certain keywords ('smaller', 'bolder', 'inherit') must be replaced according
to their definitions. See example c, d and e in the table below."

In the table the the actual values are then given in px (and I think they
should be).  The spec seems to say that the relative value (in px) should be
made absolute.  I'm not to only one who reads it like this.

http://lists.w3.org/Archives/Public/www-dom/2000AprJun/0112.html


----- Original Message -----
From: "Chris Wilson" <cwilso@microsoft.com>
To: "Mark Morin" <markpmorin@telusplanet.net>; <www-style@w3.org>
Sent: Monday, November 05, 2001 6:06 PM
Subject: RE: What is getComputedStyle supposed to be for?


"Specified" values are not necessarily interesting - they show you the
result of the CSS cascade, but that's probably not particularly useful
in real-world scenarios.  "Actual" values are very problematic to
expose- for example, the "actual" value of 'font-size' is a
per-character value, since different characters may get mapped to
different fonts.

-Chris Wilson

-----Original Message-----
From: Mark Morin [mailto:markpmorin@telusplanet.net]
Sent: Monday, November 05, 2001 3:08 PM
To: www-style@w3.org
Subject: What is getComputedStyle supposed to be for?


I think I'm confused about what the intent is of getComputedStyle.  On
seeing the name I thought that it would give me access to the final
properties of elements but, since these "actual values" can be different
from the calculated values this isn't it.

I thought maybe the idea was to give access to as much style sheet
information as was available before any user agent specific information
was used (sort of like "specified value" except without resolving
inherited to the value of the parent element since that is a computed
value).  I don't think this is it since, to convert from relative to
absolute values in some cases, detailed information about the user
agent's font and pixel size need to be used.  Not to mention the user
agent style sheet, target media, and initial containing block size.

So it seems that a way of accessing specified, computed, or actual
values could have been provided and it was chosen to provide access to
the computed values.  Why?

How was getComputedStyle intended to be used and by whom?

I'm new here so apologies if this has been asked and answered before.

Thanks

Received on Wednesday, 7 November 2001 08:44:03 UTC