Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#9659 closed bug (cantfix)

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/

Change History (3)

comment:1 Changed 12 years ago by grandpaslab

This happens when position: absolute is set.

comment:2 Changed 12 years ago by timmywil

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.

comment:3 in reply to:  2 Changed 12 years ago by grandpaslab

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.

Note: See TracTickets for help on using tickets.