Fix an issue where Element#getStyle('height') returns null if the height is set to "auto."
This commit is contained in:
parent
919b952ec3
commit
ae707f4475
|
@ -1,3 +1,5 @@
|
|||
* Fix an issue where Element#getStyle('height') returns null if the height is set to "auto." (kangax, jddalton)
|
||||
|
||||
* Add unit tests for Element#descendantOf. (jddalton)
|
||||
|
||||
* Form#serializeElements should not serialize file inputs. (kangax, Lonesome Boy)
|
||||
|
|
|
@ -387,7 +387,7 @@ Element.Methods = {
|
|||
element = $(element);
|
||||
style = style == 'float' ? 'cssFloat' : style.camelize();
|
||||
var value = element.style[style];
|
||||
if (!value) {
|
||||
if (!value || value == 'auto') {
|
||||
var css = document.defaultView.getComputedStyle(element, null);
|
||||
value = css ? css[style] : null;
|
||||
}
|
||||
|
|
|
@ -891,6 +891,10 @@ new Test.Unit.Runner({
|
|||
this.assertEqual("14px", $('style_test_dimensions').getStyle('width'));
|
||||
this.assertEqual("17px", $('style_test_dimensions').getStyle('height'));
|
||||
}
|
||||
|
||||
// height/width could always be calculated if it's set to "auto" (Firefox)
|
||||
this.assertNotNull($('auto_dimensions').getStyle('height'));
|
||||
this.assertNotNull($('auto_dimensions').getStyle('width'));
|
||||
},
|
||||
|
||||
testElementGetOpacity: function() {
|
||||
|
|
|
@ -274,4 +274,5 @@
|
|||
<div id="anonymous_element_3"></div>
|
||||
</div>
|
||||
|
||||
<div id='elementToViewportDimensions' style='display: none'></div>
|
||||
<div id='elementToViewportDimensions' style='display: none'></div>
|
||||
<div id="auto_dimensions" style="height:auto"></div>
|
Loading…
Reference in New Issue