Bug Tracker

Opened 11 years ago

Closed 11 years ago

#3183 closed bug (wontfix)

Bind an event of type "mouseenter" or "mouseleave" on map area

Reported by: slayne Owned by:
Priority: major Milestone: 1.3
Component: event Version: 1.2.6
Keywords: Cc:
Blocked by: Blocking:

Description

Hy, If I do execute this code on IE, he doesn't work :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
 <head>
  <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
  <script type="text/javascript">
   jQuery(document).ready(function(){
    jQuery("#myArea").bind("mouseenter", function(){ alert("mouse enter"); });
    jQuery("#myArea").bind("mouseover", function(){ alert("mouse over"); });
   });
  </script>
 </head>
 <body>
  <img src="http://jquery.com/demo/thickbox/images/plant4.jpg" border="0" usemap="#myMap" />
  <map name="myMap">
   <area id="myArea" shape="poly" coords="221,360,511,372,594,292,467,70,285,6,67,26,3,121" href="http://jquery.com/" alt="" />
  </map>
 </body>
</html>

I think that there is a bug in the browser, it do not fire events "onmouseenter" and "onmouseleave" on AREA element.

I have add this code line in jQuery.js at row number 2226 :

bind: function( type, data, fn ) {
 return type == "unload" ? this.one(type, data, fn) : this.each(function(){
  if (jQuery.browser.msie && this.nodeName.toLowerCase() == "area")
   type = type.replace(/mouseenter/, "mouseover").replace(/mouseleave/, "mouseout");
  jQuery.event.add( this, type, fn || data, fn && data );
 });
},

And I want your opinion on this bug.

Thanks a lot ;-)

Change History (1)

comment:1 Changed 11 years ago by flesler

Resolution: wontfix
Status: newclosed

mouseenter and mouseover are different kind of events. mouse(over|out) are real events. mouse(enter|leave) are custom events.

If IE doesn't trigger those events, just bind to the map, and check e.target to see if it was an area.

area elements are barely used, and this is the first time I see this reported, so I think there's no sense in adding so many bytes of code for this.

Cheers

Note: See TracTickets for help on using tickets.