#9786 closed bug (fixed)
unbind() Namespace Bug
Reported by: | Owned by: | Rick Waldron | |
---|---|---|---|
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.
Change History (6)
comment:1 Changed 12 years ago by
comment:2 Changed 12 years ago by
Component: | unfiled → event |
---|---|
Owner: | set to Rick Waldron |
Priority: | undecided → blocker |
Status: | new → assigned |
Confirmed. http://jsfiddle.net/rwaldron/6Tp4h/
comment:3 Changed 12 years ago by
Keywords: | needsdocs added |
---|
I just updated the fiddle above, it turns out this actually never worked.
Here it is, not working in...
- jQuery 1.2.6 http://jsfiddle.net/rwaldron/6Tp4h/6/
- jQuery 1.3.2 http://jsfiddle.net/rwaldron/6Tp4h/5/
- jQuery 1.4.4 http://jsfiddle.net/rwaldron/6Tp4h/7/
- jQuery 1.5.2 http://jsfiddle.net/rwaldron/6Tp4h/8/
I'll update the docs accordingly
comment:4 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Updated http://api.jquery.com/unbind
comment:5 Changed 12 years ago by
Keywords: | needsdocs removed |
---|
comment:6 Changed 11 years ago by
Milestone: | 1.next |
---|
Note: See
TracTickets for help on using
tickets.
Added a fiddle example: http://jsfiddle.net/6kStJ/