Opened 13 years ago
Closed 13 years ago
#5967 closed bug (fixed)
Unbind of namespaced 'change' event unbinds all 'change' events (IE only)
Reported by: | gethinw | Owned by: | brandon |
---|---|---|---|
Priority: | major | Milestone: | 1.4.2 |
Component: | event | Version: | 1.4.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
For example, myInput.unbind('change.myNS') will also unbind events bound using myInput.bind('change', function), myInput.change(function) or myInput.bind('change.otherNS', function).
Seems to be confined to Internet Explorer (present in v6-8).
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Test case</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script> <script type="text/javascript"> $(function(){ $('#myform input').bind('change', function(){alert('change event');}); $('#myform input').bind('change.ns', function(){alert('change event');}); $('#myform input').change(function(){alert('change 2 event');}); $('#myform input').unbind('change.otherns');//will unbind all three events above }); </script> </head> <body> <form id="myform"> <input type="text" value="1"> </form> </body> </html>
Change History (3)
comment:1 Changed 13 years ago by
comment:2 Changed 13 years ago by
I've just had a look at the source, and this seems to be caused a function in jQuery.event.special.change (and similarly in jQuery.event.special.submit) being incorrectly named "remove" rather than "teardown", causing all of the special functionality to be removed when any single event is removed.
Does someone want to update this, or direct me to some instructions on how I'd go about doing that?
comment:3 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Just to add, even doing a namespace-wide unbind with no event type specified (ie unbind('.namespace')) seems to cause this problem.