#7885 closed bug (fixed)
jQuery .offset doesn't property works when current offset is float (which is possible in FireFox)
| Reported by: | acc15 | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | 1.6 |
| Component: | manipulation | Version: | 1.4.4 |
| Keywords: | Cc: | ||
| Blocked by: | Blocking: |
Description
Applies to
FireFox 3.6.13
How to reproduce
- jQuery 1.4.4
- FireFox 3.6.13
- Open test page
Test page:
<html>
<head>
<title>test</title>
<script type="text/javascript" src="jquery-1.4.4.js"></script>
</head>
<body>
<div id="test" style="position:ablosute;background-color:blue;left:10.7432222px;top:10.532325px;width:100px;height:100px;">TEST</div>
<script type="text/javascript">
$(document).ready(function() {
var expected = {left:100,top:100};
$('#test').offset(expected);
var actual = $('#test').offset();
alert(expected.left == actual.left && expected.top == actual.top ? 'bug has been fixed' : 'bug still remains, expected [' + expected.left + '; ' + expected.top +
'], actual [' + actual.left + '; ' + actual.top + ']');
});
</script>
</body>
</html>
Workaround
use
$('#test').css(expected);
Change History (7)
comment:1 Changed 9 years ago by
comment:3 Changed 9 years ago by
| Resolution: | → patchwelcome |
|---|---|
| Status: | new → closed |
Related to 7730.
If Firefox decides to mangle the offset values there isn’t a lot that can be done. In any case, it’s not something that we are probably going to spend time on. Feel free to submit a patch that works consistently across all browsers without causing trouble with devices that support sub-pixel precision and we would be happy to consider it.
comment:4 Changed 9 years ago by
| Component: | unfiled → manipulation |
|---|---|
| Milestone: | 1.6 |
comment:6 Changed 9 years ago by
| Milestone: | → 1.6 |
|---|---|
| Resolution: | patchwelcome |
| Status: | closed → reopened |
comment:7 Changed 9 years ago by
| Priority: | undecided → low |
|---|---|
| Resolution: | → fixed |
| Status: | reopened → closed |
Note: See
TracTickets for help on using
tickets.

http://jsfiddle.net/tD4pC/1/
fiddle url...