Skip to content

Commit

Permalink
fix: regression of #38989
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoSot committed Sep 18, 2023
1 parent d9baa2f commit f8fc167
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
6 changes: 3 additions & 3 deletions js/src/dom/selector-engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
30 changes: 30 additions & 0 deletions js/tests/unit/modal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,36 @@ describe('Modal', () => {
trigger.click()
})
})

it('should open modal, having special characters in its id', () => {
return new Promise(resolve => {
fixtureEl.innerHTML = [
'<button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#j_id22:exampleModal">',
' Launch demo modal',
'</button>',
'<div class="modal fade" id="j_id22:exampleModal" aria-labelledby="exampleModalLabel" aria-hidden="true">',
' <div class="modal-dialog">',
' <div class="modal-content">',
' <div class="modal-body">',
' <p>modal body</p>',
' </div>',
' </div>',
' </div>',
'</div>',
].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 <a> or <area>', () => {
return new Promise(resolve => {
fixtureEl.innerHTML = [
Expand Down

0 comments on commit f8fc167

Please sign in to comment.