Bug Tracker

Modify

Ticket #9659 (closed bug: cantfix)

Opened 2 years ago

Last modified 2 years ago

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:
Blocking: Blocked by:

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

comment:1 Changed 2 years ago by grandpaslab

This happens when position: absolute is set.

comment:2 follow-up: ↓ 3 Changed 2 years ago by timmywil

  • Priority changed from undecided to low
  • Resolution set to cantfix
  • Status changed from new to closed
  • Component changed from unfiled to css

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 2 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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.