mirror of
https://github.com/twbs/bootstrap.git
synced 2024-11-29 11:24:18 +01:00
Fix collapse multiple ids target (#38989)
This commit is contained in:
parent
d1d49ffe1d
commit
9900cf33c0
@ -26,10 +26,10 @@ const getSelector = element => {
|
||||
hrefAttribute = `#${hrefAttribute.split('#')[1]}`
|
||||
}
|
||||
|
||||
selector = hrefAttribute && hrefAttribute !== '#' ? hrefAttribute.trim() : null
|
||||
selector = hrefAttribute && hrefAttribute !== '#' ? parseSelector(hrefAttribute.trim()) : null
|
||||
}
|
||||
|
||||
return parseSelector(selector)
|
||||
return selector
|
||||
}
|
||||
|
||||
const SelectorEngine = {
|
||||
|
@ -359,6 +359,18 @@ describe('SelectorEngine', () => {
|
||||
expect(SelectorEngine.getMultipleElementsFromSelector(testEl)).toEqual(Array.from(fixtureEl.querySelectorAll('.target')))
|
||||
})
|
||||
|
||||
it('should get elements if several ids are given', () => {
|
||||
fixtureEl.innerHTML = [
|
||||
'<div id="test" data-bs-target="#target1,#target2"></div>',
|
||||
'<div class="target" id="target1"></div>',
|
||||
'<div class="target" id="target2"></div>'
|
||||
].join('')
|
||||
|
||||
const testEl = fixtureEl.querySelector('#test')
|
||||
|
||||
expect(SelectorEngine.getMultipleElementsFromSelector(testEl)).toEqual(Array.from(fixtureEl.querySelectorAll('.target')))
|
||||
})
|
||||
|
||||
it('should get elements in array, from href if no data-bs-target set', () => {
|
||||
fixtureEl.innerHTML = [
|
||||
'<a id="test" href=".target"></a>',
|
||||
|
Loading…
Reference in New Issue
Block a user