Skip to main content

Bug Tracker

Side navigation

#9659 closed bug (cantfix)

Opened June 23, 2011 04:13PM UTC

Closed June 23, 2011 04:25PM UTC

Last modified June 23, 2011 04:55PM UTC

CSS "left" value is incorrect when set to "auto" in FF4

Reported by: grandpaslab Owned by:
Priority: low Milestone: 1.next
Component: css Version: 1.6.1
Keywords: Cc:
Blocked by: Blocking:
Description

When using $(selector).css("left") in FireFox 4.0.1, a pixel value is returned when the "left" attribute is set to "auto".

Chrome 12.0.742.100 correctly returns "auto".

http://jsfiddle.net/5qtRX/

Attachments (0)
Change History (3)

Changed June 23, 2011 04:19PM UTC by grandpaslab comment:1

This happens when position: absolute is set.

Changed June 23, 2011 04:25PM UTC by timmywil comment:2

component: unfiledcss
priority: undecidedlow
resolution: → cantfix
status: newclosed

Test case with jQuery git: http://jsfiddle.net/timmywil/5qtRX/4/

I don't think there's anything we can do. Firefox is actually doing the best thing here. css should return computed values, but if no computed value is present, it falls back to uncomputed styles. Firefox gives us an actual computed value while other browsers only give "auto" for a computed value.

Changed June 23, 2011 04:55PM UTC by grandpaslab comment:3

Computed values are what's expected? I would assume that .css() would return what's set in the css. If I wanted a computed value, I would have used .offset().left. In my use case, I am trying to save current css values so I can re-set them later. If .css() won't give me the current values it looks like there's no jquery way to get them.

BTW my current hack/workaround is to unset the position attribute before retrieving the left value.