Bug Tracker

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: siva.dirisala@… Owned by:
Priority: high Milestone: 1.next
Component: offset Version: 1.5.1
Keywords: ie6 ie7 ie8 Cc:
Blocked by: Blocking:


The following works in Firefox but not IE (tested 7 and 8).

<script src="http://code.jquery.com/jquery-latest.js"></script>
<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;">

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 siva.dirisala@…

The above code saved at http://jsfiddle.net/hceHw/

comment:2 Changed 12 years ago by Rick Waldron

Component: unfiledoffset
Keywords: needsreview added
Priority: undecidedhigh
Status: newopen

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

	position: function() {

	parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();



comment:3 Changed 11 years ago by anonymous

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 dmethvin

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 dmethvin

Keywords: ie6 ie7 ie8 added; needsreview removed

comment:6 Changed 11 years ago by Nowres Rafid

Resolution: fixed
Status: openclosed

Fix #8482, offsetParent should not return null. Closes gh-847.

Changeset: aaf134bb7092efe7b450fc08ca5cc3c53cb00d76

Note: See TracTickets for help on using tickets.