Bug Tracker

Modify

Ticket #9786 (closed bug: fixed)

Opened 23 months ago

Last modified 15 months ago

unbind() Namespace Bug

Reported by: markp@… Owned by: rwaldron
Priority: blocker Milestone:
Component: event Version: 1.6.2
Keywords: Cc:
Blocking: Blocked by:

Description

I was working with 2 event handlers and wanted to make sure I removed them before creating any news ones, so that multiples were never created.

The code I used has been simplified but was similar to:

// To unbind both events before creating new ones
$(this).unbind(".jpRepeat.jpNext");

$(this).bind("someEvent.myProject.jpRepeat", function () {
  // Repeat
});
$(this).bind("someEvent.myProject.jpNext", function () {
  // Next
});

This was not removing both the events through the namespace. It was removing neither.

Changing it to this worked:

$(this).unbind(".jpRepeat").unbind(".jpNext");

Reading the docs suggests that both ways should have the same effect.

Change History

comment:1 Changed 23 months ago by markp@…

Added a fiddle example:  http://jsfiddle.net/6kStJ/

comment:2 Changed 23 months ago by rwaldron

  • Owner set to rwaldron
  • Priority changed from undecided to blocker
  • Status changed from new to assigned
  • Component changed from unfiled to event

comment:3 Changed 23 months ago by rwaldron

  • Keywords needsdocs added

I just updated the fiddle above, it turns out this actually never worked.

Here it is, not working in...

I'll update the docs accordingly

comment:4 Changed 23 months ago by rwaldron

  • Status changed from assigned to closed
  • Resolution set to fixed

comment:5 Changed 23 months ago by rwaldron

  • Keywords needsdocs removed

comment:6 Changed 15 months ago by dmethvin

  • Milestone 1.next deleted

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.