jquery/standards — Issue #5: Imagemap AREA tags' offsetLeft and offsetTop are not defined in the HTML spec
Author: bitcrazed
Created: 2011-10-24 22:14:23+00:00
State: open

Problem: Imagemap AREA tags' offsetLeft and offsetTop are not defined in the HTML spec which has led to different browsers exhibiting different behaviors.

Consider an HTML ImageMap with a couple of AREA’s:
```

```

Using jQuery/javascript, attach mouseover events to the AREA tags. In the event handler, examine the AREA tag’s offset left & top parameters.

IE exhibits what I believe to be the correct behavior, but both Firefox and Chrome exhibit incorrect, and different behaviors:

* IE9 reports the offsetLeft and offsetTop correctly
* Firefox returns the offsetLeft and offsetTop of the image itself.
* WebKit/Chrome return 0 for both offsetLeft and offsetTop!

This bug prevents reliably determination of the bounding box surrounding an AREA using the offsetLeft and offsetTop parameters. Because of the inconsistent browser behaviors, To work around this, developers have to write code to calculate the bounding box from the cords list for rect and poly area types and also for circle area types.

I’ve filed bugs against Firefox ([here](https://bugzilla.mozilla.org/show_bug.cgi?id=694343)) and Chrome ([here](http://code.google.com/p/chromium/issues/detail?id=99286&can=4&colspec=ID%20Stars%20Pri%20Area%20Feature%20Type%20Status%20Summary%20Modified%20Owner%20Mstone%20OS)) for this issue.

I had originally discovered this issue when using the jQuery .position() method which fails because of the above difference in behavior. Please consider driving a common understanding of the offsetTop and offsetLeft properties of AREA tags through the W3C HTML spec process.