Merged
requested to merge github/fork/RoflCopter24/32273-dropdown-item-error-with-external-link into main
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)