diff --git a/js/src/dom/selector-engine.js b/js/src/dom/selector-engine.js index a47f72001bd5..013971c255ed 100644 --- a/js/src/dom/selector-engine.js +++ b/js/src/dom/selector-engine.js @@ -26,10 +26,10 @@ const getSelector = element => { hrefAttribute = `#${hrefAttribute.split('#')[1]}` } - selector = hrefAttribute && hrefAttribute !== '#' ? parseSelector(hrefAttribute.trim()) : null + selector = hrefAttribute && hrefAttribute !== '#' ? hrefAttribute.trim() : null } - - return selector + + return selector.split(',').map(sel=>parseSelector(sel)).join(',') } const SelectorEngine = { diff --git a/js/tests/unit/modal.spec.js b/js/tests/unit/modal.spec.js index 6434d8b3cca2..d3be6f776e16 100644 --- a/js/tests/unit/modal.spec.js +++ b/js/tests/unit/modal.spec.js @@ -989,6 +989,36 @@ describe('Modal', () => { trigger.click() }) }) + + it('should open modal, having special characters in its id', () => { + return new Promise(resolve => { + fixtureEl.innerHTML = [ + '', + '', + ].join('') + + const modalEl = fixtureEl.querySelector('.modal') + const trigger = fixtureEl.querySelector('[data-bs-toggle="modal"]') + + + modalEl.addEventListener('shown.bs.modal', () => { + resolve() + }) + + trigger.click() + }) + }) + it('should not prevent default when a click occurred on data-bs-dismiss="modal" where tagName is DIFFERENT than or ', () => { return new Promise(resolve => { fixtureEl.innerHTML = [