Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Issues
  • #14462
Closed
Open
Issue created Aug 26, 2014 by Administrator@rootContributor

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.

Assignee
Assign to
Time tracking