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
  • #32273
Closed
Open
Issue created Nov 28, 2020 by Administrator@rootContributor

Dropdown-item error with external link when using Scrollspy.

Created by: jeijei4

Hello! I am using Bootstrap 5.0.0-alpha3.

<li><a class="dropdown-item" href="https://duckduckgo.com/">other</a></li>

Using Scrollspy I added in a dropdown a dropdown-item that contains a link to an external page (https://duckduckgo.com/) and I get an error in the console.

The error occurs on the following line: https://github.com/twbs/bootstrap/blob/c63aebc86ba05f0ebb420add653b80804c6a0cff/dist/js/bootstrap.bundle.js#L96-L102

If the selector variable is equal to some external link such as "https://duckduckgo.com/", the following error occurs:

- 'https://duckduckgo.com/' is not a valid selector

My proposal is to enclose it in a try catch:

  var selector = getSelector(element);

  try {
    return document.querySelector(selector) ? selector : null;
  } catch (_) {
    return null;
  }

Operating system: "windows 10"; Browser and version : {"Firefox":"83.0", "Microsoft Edge":"87.0.664.47"};

A reduced test case here.

Assignee
Assign to
Time tracking