#6949 closed bug (invalid)
.offset() in IE changes position from absolute to relative
Reported by: | cimiak | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | 1.4.3 |
Component: | offset | Version: | 1.4.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Set the current coordinates using .offset(). If the element's position style property is currently absolute, it is set to relative in IE8. It remains absolute in Firefox as expected.
Change History (3)
comment:1 Changed 13 years ago by
need: | Review → Test Case |
---|---|
Priority: | → undecided |
Resolution: | → invalid |
Status: | new → closed |
comment:2 Changed 12 years ago by
i have a test case for this issue. http://jsfiddle.net/qdLrq/
in firefox, the div will retain its absolute positioning, but in IE, it will be set to relative. the code that does this is at line 8119 in jquery 1.5.1.
// set position first, in-case top/left are set even on static elem if ( position === "static" ) { elem.style.position = "relative"; }
it appears that it only happens when you set the offset before you add it to the page in IE.
here's a work-around for anyone that wants it:
//v1.offset(v2.offset()); v1.css('left', v2.offset().left).css('top', v2.offset().top);
comment:3 Changed 10 years ago by
This issue just hit me in jQuery 1.9.1 and the workaround solved my issue. Not sure why this bug is invalid as it is unexpected behaviour that is inconsistent across browsers.
Having tested the bug reported in this ticket in both FireFox 3.6.10, IE 8.0 and IE 9.0, I've noted that jQuery is outputting the same relative positioning regardless of the browser being tested in.
As this behaviour is consistent and suggests the original ticket may not be a genuine issue with the core, please re-submit your ticket including the version of FireFox where offset() was outputting absolute positioning so we can test further.
If you could also include a valid test case/code example of what you're trying to do (if other than just using .offset()) that too would be of help.
Closing for now.