Skip to main content

Bug Tracker

Side navigation

#9786 closed bug (fixed)

Opened July 08, 2011 10:43PM UTC

Closed July 08, 2011 11:47PM UTC

Last modified March 02, 2012 04:30PM UTC

unbind() Namespace Bug

Reported by: markp@happyworm.com Owned by: rwaldron
Priority: blocker Milestone:
Component: event Version: 1.6.2
Keywords: Cc:
Blocked by: Blocking:
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.

Attachments (0)
Change History (6)

Changed July 08, 2011 10:58PM UTC by markp@happyworm.com comment:1

Added a fiddle example:

http://jsfiddle.net/6kStJ/

Changed July 08, 2011 11:09PM UTC by rwaldron comment:2

component: unfiledevent
owner: → rwaldron
priority: undecidedblocker
status: newassigned

Changed July 08, 2011 11:31PM UTC by rwaldron comment:3

keywords: → needsdocs

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

Changed July 08, 2011 11:47PM UTC by rwaldron comment:4

resolution: → fixed
status: assignedclosed

Changed July 08, 2011 11:47PM UTC by rwaldron comment:5

keywords: needsdocs

Changed March 02, 2012 04:30PM UTC by dmethvin comment:6

milestone: 1.next