Bug Tracker

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:


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).

    <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">
        $('#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
    <form id="myform">
      <input type="text" value="1">

Change History (3)

comment:1 Changed 13 years ago by gethinw

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

comment:2 Changed 13 years ago by gethinw

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 john

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.