Bug Tracker

Opened 8 years ago

Closed 8 years ago

#11580 closed bug (invalid)

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

Reported by: scott.vanlooy@… 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

Change History (2)

comment:1 Changed 8 years ago by scott.vanlooy@…

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

comment:2 Changed 8 years ago by sindresorhus

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.

Note: See TracTickets for help on using tickets.