Skip to main content

Bug Tracker

Side navigation

#5967 closed bug (fixed)

Opened January 28, 2010 03:26PM UTC

Closed February 05, 2010 04:03PM UTC

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

Changed January 28, 2010 05:11PM UTC by gethinw comment:1

Just to add, even doing a namespace-wide unbind with no event type specified (ie unbind('.namespace')) seems to cause this problem.

Changed February 02, 2010 10:06AM UTC by gethinw comment:2

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?

Changed February 05, 2010 04:03PM UTC by john comment:3

resolution: → fixed
status: newclosed