Side navigation
#12502 closed bug (cantfix)
Opened September 10, 2012 02:59PM UTC
Closed September 10, 2012 04:48PM UTC
Last modified September 10, 2012 08:36PM UTC
Bug in .css() regarding positioning with non-pixel values
Reported by: | wyverns.spirit@gmail.com | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | css | Version: | 1.8.0 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
If you have an absolutely positioned element using anything but a pixel value for its position, trying to access the value with .css() will transform it to a pixel value. A barebones example: http://jsfiddle.net/DqXyK/
This happens in every browser except for webkit. We recently updated our jquery from version 1.4.2 to 1.8.0, which marks the regression point for us. The first comment on http://api.jquery.com/css/ describes the same bug in version 1.4.4. We couldn't find a bug report in the tracker, so I opened a new one. Thanks in advance for checking it out!
Attachments (0)
Change History (3)
Changed September 10, 2012 04:48PM UTC by comment:1
component: | unfiled → css |
---|---|
priority: | undecided → low |
resolution: | → cantfix |
status: | new → closed |
Changed September 10, 2012 08:21PM UTC by comment:2
Replying to [comment:1 mikesherov]:
We're not going to fix these differences at this point, mainly because we can't. I've advocated fo consistency at the browser vendor and standards body level, and they're working on it. If you'd like the position in pixels, please use the jQuery .position() and .offset() methods.
Fair enough. To anyone else stumbling across this: We've worked around it by using the native
$test[0].style.leftinstead of
$test.css('left')to get the percentage value in all browsers.
Changed September 10, 2012 08:36PM UTC by comment:3
also, .style.left only works for styles applied directly to an element.
We're not going to fix these differences at this point, mainly because we can't. I've advocated fo consistency at the browser vendor and standards body level, and they're working on it.
If you'd like the position in pixels, please use the jQuery .position() and .offset() methods.