Opened 11 years ago
Closed 11 years ago
#11580 closed bug (invalid)
unbind with added spaces unbinds everything, not just the namespaced events.
Reported by: | 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 11 years ago by
comment:2 Changed 11 years ago by
Component: | unfiled → event |
---|---|
Priority: | undecided → low |
Resolution: | → invalid |
Status: | new → closed |
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.
http://jsfiddle.net/MbLnK/ (sorry, should've read the guidelines first!)