Skip to content

invalid selector regression in 5.3.2 #39189

@codylerum

Description

@codylerum

Prerequisites

Describe the issue

After updating to Bootstrap 5.3.2 we have errors where modals are failing to open due to the query selector failing as invalid

selector-engine.js:41 Uncaught DOMException: Failed to execute 'querySelector' on 'Element': '#j_id22:exampleModal' is not a valid selector.
    at Object.findOne (https://cdn.jsdelivr.net/npm/bootstrap@latest/dist/js/bootstrap.bundle.min.js:6:8558)
    at Object.getElementFromSelector (https://cdn.jsdelivr.net/npm/bootstrap@latest/dist/js/bootstrap.bundle.min.js:6:9299)
    at HTMLButtonElement.<anonymous> (https://cdn.jsdelivr.net/npm/bootstrap@latest/dist/js/bootstrap.bundle.min.js:6:55221)
    at HTMLDocument.n (https://cdn.jsdelivr.net/npm/bootstrap@latest/dist/js/bootstrap.bundle.min.js:6:4238)

The target is like data-bs-target="#j_id22:exampleModal". This is a common auto generated identifier from JSF where : is used as a seperator.

This code works in 5.3.1 but fails in 5.3.2

Reduced test cases

Working in 5.3.1: https://codepen.io/codylerum/details/OJrjvBx

Failing in 5.3.2: https://codepen.io/codylerum/pen/WNLEzKz

What operating system(s) are you seeing the problem on?

macOS

What browser(s) are you seeing the problem on?

Chrome

What version of Bootstrap are you using?

5.3.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions