Skip to main content

Bug Tracker

Side navigation

#8497 closed bug (cantfix)

Opened March 10, 2011 08:05PM UTC

Closed March 30, 2011 06:32PM UTC

jQuery.css and jQuery.cssHooks

Reported by: ex.devote@gmail.com 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 :-(

Attachments (0)
Change History (6)

Changed March 10, 2011 10:06PM UTC by Yomodo comment:1

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;

Changed March 11, 2011 12:04AM UTC by devote comment:2

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 (((

Changed March 11, 2011 12:15AM UTC by devote comment:3

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"

Changed March 14, 2011 02:56PM UTC by dmethvin comment:4

See also #7395

Changed March 18, 2011 04:04AM UTC by devote <ex.devote@gmail.com> comment:5

Replying to [comment:4 dmethvin]:

See also #7395

I do not understand is how can you specify a ticket for my ticket, I'm talking about function .css() and not about .width() and .height()

Changed March 30, 2011 06:32PM UTC by john comment:6

component: unfiledcss
resolution: → cantfix
status: newclosed

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.