Skip to main content

Bug Tracker

Side navigation

#11580 closed bug (invalid)

Opened April 10, 2012 04:25PM UTC

Closed April 10, 2012 09:49PM UTC

unbind with added spaces unbinds everything, not just the namespaced events.

Reported by: scott.vanlooy@akqa.com Owned by:
Priority: low Milestone: None
Component: event Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:
Description

Test code:

$(window).unbind();

$(window).bind('click', function () {

console.log('test')

});

$(window).bind('click.test1', function () {

console.log('test ns 1')

});

$(window).bind('click.test2', function () {

console.log('test ns 2')

});

$(window).unbind('click.test1 click.test2');

You'd expect this to still console log 'test' but it doesn't, because there's an extra space in the unbind. This worked in jQuery 1.6

Attachments (0)
Change History (2)

Changed April 10, 2012 04:29PM UTC by scott.vanlooy@akqa.com comment:1

http://jsfiddle.net/MbLnK/ (sorry, should've read the guidelines first!)

Changed April 10, 2012 09:49PM UTC by sindresorhus comment:2

component: unfiledevent
priority: undecidedlow
resolution: → invalid
status: newclosed

Even though it worked in 1.6 doesn't necessarily mean it's an regression.

.on() docs:

One or more space-separated event types...

This usually means one space separator. I can't think of any reason you'd want to use more than one space.