Skip to main content

Bug Tracker

Side navigation

#6676 closed bug (duplicate)

Opened June 15, 2010 06:30PM UTC

Closed August 18, 2010 03:27AM UTC

.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>
Attachments (0)
Change History (1)

Changed August 18, 2010 03:27AM UTC by dmethvin comment:1

resolution: → duplicate
status: newclosed

Dup of #6184.