#12502 closed bug (cantfix)
Bug in .css() regarding positioning with non-pixel values
Reported by: | 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!
Change History (3)
comment:1 follow-up: 2 Changed 11 years ago by
Component: | unfiled → css |
---|---|
Priority: | undecided → low |
Resolution: | → cantfix |
Status: | new → closed |
comment:2 Changed 11 years ago by
Replying to 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.left
instead of $test.css('left')
to get the percentage value in all browsers.
comment:3 Changed 11 years ago by
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.