- From: Joćo Eiras <joao.eiras@gmail.com>
- Date: Mon, 31 Mar 2008 02:46:32 +0100
- To: "Kartikaya Gupta" <kagupta@rim.com>, "www-dom@w3.org" <www-dom@w3.org>
Na , Kartikaya Gupta <kagupta@rim.com> escreveu: > The getComputedStyle return value is already well defined to be the > "computed" values as described in > http://www.w3.org/TR/CSS21/cascade.html#computed-value. Yes, computed values are well defined, but DOM 2 StyleSheets defines getComputedStyle to return absolute (or used) values, not computed values. That's the issue. > That's what UAs are supposed to be returning. The computed results are > what come out of the cascade, but before the actual layout algorithm is > run. In some cases "auto" is the correct value to be returned, since > those values cannot be determined until layout time. The actual > representation of the value (i.e. rgb(n,n,n) vs #rrggbb) isn't > specified, so if you want to be safe you can use the getPropertyCSSValue > method on the CSSStyleDeclaration interface to retrieve a structured > object rather than a string. > > As for getOverrideStyle, that's provided so that DOM implementers can > override specific styles. Styles that are returned by getOverrideStyle > have the highest weight in the cascade and will override all other > styles. It's not really of much use to web developers though. > > Hope that helps. > > -----Original Message----- > From: www-dom-request@w3.org [mailto:www-dom-request@w3.org] On Behalf > Of Joćo Eiras > Sent: Sunday, March 30, 2008 9:21 PM > To: www-dom@w3.org > Subject: getComputedStyle results > > > > Hi! > > The spec for getComputedStyle says the following: > > > http://www.w3.org/TR/DOM-Level-2-Style/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 > > 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 > 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. > > > --------------------------------------------------------------------- > This transmission (including any attachments) may contain confidential > information, privileged material (including material protected by the > solicitor-client or other applicable privileges), or constitute > non-public information. Any use of this information by anyone other than > the intended recipient is prohibited. If you have received this > transmission in error, please immediately reply to the sender and delete > this information from your system. Use, dissemination, distribution, or > reproduction of this transmission by unintended recipients is not > authorized and may be unlawful.
Received on Monday, 31 March 2008 01:47:39 UTC