Bug Tracker

Opened 9 years ago

Closed 9 years ago

#6676 closed bug (duplicate)

.unbind causes "elem.removeEventListener is not a function" at #2070 for non-DOM objects

Reported by: mu Owned by:
Priority: Milestone: 1.4.2
Component: event Version: 1.4.2
Keywords: Cc:
Blocked by: Blocking:

Description

If JQuery event handlers are bound to non-DOM JS objects, .unbind throws an error while unbinding the last listener. removeElement on line 2068 makes an assumption that the passed in 'elem' param is a DOM object.

The issue is NOT found in 1.3.2.

Sample test case:

<html> 
<head><script src="http://code.jquery.com/jquery-1.4.2.js"></script></head>
<body>

<script language="javascript">
var m = {};

$(m).bind("myevent.f1", function (){});	
$(m).bind("myevent.f2", function (){});

$(m).unbind('myevent.f1');

/*
 The following line causes a JS Error at jquery-1.4.2.js (line 2070).

elem.removeEventListener is not a function
elem.removeEventListener( type, handle, false );   
*/
$(m).unbind('myevent.f2'); 
</script>

</body>
</html>

Change History (1)

comment:1 Changed 9 years ago by dmethvin

Resolution: duplicate
Status: newclosed

Dup of #6184.

Note: See TracTickets for help on using tickets.