Re: Which value is returned by Element.getStyle() getProperty() ?
Thanks for this interesting link!
I found, among others, 2 complementary answers:
- element.style.getPropertyValue(styleName) gives the value defined in
the style attribute of the element, as coded in the html file.
- window.getComputedStyle(element, null).getPropertyValue(styleName)
gives the actual "used value" to render the element, taking into
account the element's style attribute, css style sheet file and any
programatic changes.
After some tests it seems that the GWT implementation in Style.java
(return this[name];) is equivalent to
element.style.getPropertyValue(name).
There is one more question left : this doesn't always work for
shorthand properties !
For example, let's take the PushButton as defined in the GWT "clean"
theme css file, and look at the values returned by
window.getComputedStyle(element, null).getPropertyValue(styleName) :
- the "background" property value as defined in "clean" is
"url('images/hborder.png') repeat-x 0px -27px" which is returned by
window.getComputedStyle in its "used value" form => ok
- the "border" property value as defined in "clean" is "1px solid
#bbb" but an empty string is returned by window.getComputedStyle =>
not ok !!
This is probably because the "border-bottom" property is also defined
that breaks the possibility to get a global value for the "border"
property.
May be in this case the only way to get the "border" value is to read
the css file using something like
var ss = document.styleSheets[1];
return ss.cssRules[0].style.border;
But it is no more a "used value" as defined here
https://developer.mozilla.org/en/CSS/used_value
Yves
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home