Skip to main content

Bug Tracker

Side navigation

#8482 closed bug (fixed)

Opened March 09, 2011 06:16AM UTC

Closed July 06, 2012 02:04PM UTC

position() on AREA element errors in IE (tested IE 7 and 8)

Reported by: siva.dirisala@gmail.com 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.

Attachments (0)
Change History (6)

Changed March 09, 2011 06:24AM UTC by siva.dirisala@gmail.com comment:1

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

Changed March 09, 2011 02:38PM UTC by rwaldron comment:2

component: unfiledoffset
keywords: → needsreview
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

jQuery.fn.extend({
	position: function() {
	...

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

  ...

  },
  ...


Changed June 01, 2012 03:13AM UTC by anonymous comment:3

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.

Changed June 01, 2012 01:46PM UTC by dmethvin comment:4

The test cases from rwaldron have an HTML5 doctype in jsFiddle so I don't think that's it.

Changed June 26, 2012 02:00AM UTC by dmethvin comment:5

keywords: needsreviewie6 ie7 ie8

Changed July 06, 2012 02:04PM UTC by Nowres Rafid comment:6

resolution: → fixed
status: openclosed

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

Changeset: aaf134bb7092efe7b450fc08ca5cc3c53cb00d76