Opened 12 years ago
Closed 12 years ago
#8497 closed bug (cantfix)
jQuery.css and jQuery.cssHooks
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | 1.next |
Component: | css | Version: | 1.5.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
jQuery 1.5.1 on line 5886 and line 5895
return val === "" | | val === "auto"? "0px": val;
Why did the return value is 0px instead of auto or emptiness?
var h = jQuery('<div style="height: auto;"></ div>').css('height');
variable h is equal to "0px" / / This is not right!
I have half the scripts because of this has stopped working :-(
Change History (6)
comment:1 Changed 12 years ago by
comment:2 Changed 12 years ago by
Current value of offsetHeight and offsetWidth is irrelavent to my concern.
in my css I have value "auto" but I'm getting "0px" in variable h
What's been set up as an "auto" should return as na "auto" I don't need it to be "0px" It's surely a bug (((
comment:3 Changed 12 years ago by
jQuery v1.4.2
alert(jQuery('<div style="height: auto;"></div>').css('height'));
result is showing "auto" Correct value :=)
jQuery v1.5.1
alert(jQuery('<div style="height: auto;"></div>').css('height'));
result is showing "0px" This is incorrect value, should be "auto"
comment:5 Changed 12 years ago by
comment:6 Changed 12 years ago by
Component: | unfiled → css |
---|---|
Resolution: | → cantfix |
Status: | new → closed |
The reason why we changed to returning a computed value is that it's consistent across all browsers -- it's impossible to reliably determine if a CSS property will return "auto" across all browsers. .css() returns the numerical, computed value.
As far as I know CSS does not require an unit indicator when a value is 0. Eg: border:0; is officially allowed instead of border:0px;