Opened 12 years ago
Closed 11 years ago
#8482 closed bug (fixed)
position() on AREA element errors in IE (tested IE 7 and 8)
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | high | Milestone: | 1.next |
Component: | offset | Version: | 1.5.1 |
Keywords: | ie6 ie7 ie8 | Cc: | |
Blocked by: | Blocking: |
Description
The following works in Firefox but not IE (tested 7 and 8).
<html> <head> <script src="http://code.jquery.com/jquery-latest.js"></script> </head> <body> <img id="logo" src="http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif" usemap="#imgmap"> <map name="imgmap" id="imgmap"> <area shape="rect" coords="0,0,200,50" onclick="alert($(this).position().top);return false;"> </map> </body> </html>
The problem is with the offsetParent function. In this function, doing jQuery.css(offsetParent,"position") on the MAP element seems to error out in IE.
This is the reason some of the tooltip plugins like the JQuery Tools tooltip plugin don't work.
Change History (6)
comment:1 Changed 12 years ago by
comment:2 Changed 12 years ago by
Component: | unfiled → offset |
---|---|
Keywords: | needsreview added |
Priority: | undecided → high |
Status: | new → open |
Confirmed. Seems to exist going as far back as 1.3.2, but does not exist in 1.2.6
Edge: http://jsfiddle.net/rwaldron/hceHw/1/ 1.3.2: http://jsfiddle.net/rwaldron/hceHw/4/ 1.2.6: http://jsfiddle.net/rwaldron/hceHw/5/
The issue is at line 228 of src/offsets.js
jQuery.fn.extend({ position: function() { ... parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset(); ... }, ...
comment:3 Changed 11 years ago by
this may be related to this: http://blogs.korzh.com/progtips/2008/07/02/ie-quirk-offsetparent-of-dom-element-added-into-document-body.html Seeing that the example has no doctype declaration... IE Quirks mode is a scary place.
comment:4 Changed 11 years ago by
The test cases from rwaldron have an HTML5 doctype in jsFiddle so I don't think that's it.
comment:5 Changed 11 years ago by
Keywords: | ie6 ie7 ie8 added; needsreview removed |
---|
comment:6 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | open → closed |
Fix #8482, offsetParent should not return null. Closes gh-847.
Changeset: aaf134bb7092efe7b450fc08ca5cc3c53cb00d76
The above code saved at http://jsfiddle.net/hceHw/