Unable to unbind specific selectors for keydown.bs.dropdown.data-api
Created by: Ben-Russell
On the following line: https://github.com/twbs/bootstrap/blob/master/js/dropdown.js#L157
The selectors '[data-toggle="dropdown"], [role="menu"], [role="listbox"]'
are all delegated in a single selector.
While it looks nicer in the source, due to how jquery must store/process this selector, this means these selectors can not be individually unbound.
The only two ways to unbind the event are:
$(document).off("keydown.bs.dropdown.data-api", '[data-toggle="dropdown"], [role="menu"], [role="listbox"]', $.fn.dropdown.Constructor.prototype.keydown);
$(document).off("keydown.bs.dropdown.data-api", '[data-toggle="dropdown"], [role="menu"], [role="listbox"]');
If they were separately delegated, then the following should be possible:
$(document).off("keydown.bs.dropdown.data-api", '[role="listbox"]', $.fn.dropdown.Constructor.prototype.keydown);
I came across this problem with the dropdowns, but this might be a problem in other plugins as well.