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
  • Merge requests
  • !32586

Prevent `getSelector` from returning URLs as selector

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/RoflCopter24/32273-dropdown-item-error-with-external-link into main Dec 22, 2020
  • Overview 2
  • Commits 11
  • Pipelines 0
  • Changes 2

Created by: RoflCopter24

As discussed in issue #32273 (closed) the Dropdown and Scrollspy Modules crash with Uncaught DOMException: Failed to execute 'querySelector' on 'Document': 'foo/bar.html' is not a valid selector when there happens to be an actual URL in the href.

The culprit seems to be, that https://github.com/twbs/bootstrap/blob/9b7bb7b568e890a088999b023aabf4898dcd1117/js/src/util/index.js#L35-L45 does no checks if that href contains a valid selector.

This pull request aims to prevent that case by adding conditions that only allow class selectors (.target) and anchors/IDs (#target) to be returned as selectors, thus preventing crashes caused by real URLs.

Fixes #32273 (closed)

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/RoflCopter24/32273-dropdown-item-error-with-external-link