mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-07 14:16:47 +02:00
scrollspy.js: chain functions (#35139)
This commit is contained in:
@@ -110,8 +110,7 @@ class ScrollSpy extends BaseComponent {
|
|||||||
this._scrollHeight = this._getScrollHeight()
|
this._scrollHeight = this._getScrollHeight()
|
||||||
|
|
||||||
const targets = SelectorEngine.find(SELECTOR_LINK_ITEMS, this._config.target)
|
const targets = SelectorEngine.find(SELECTOR_LINK_ITEMS, this._config.target)
|
||||||
|
.map(element => {
|
||||||
for (const item of targets.map(element => {
|
|
||||||
const targetSelector = getSelectorFromElement(element)
|
const targetSelector = getSelectorFromElement(element)
|
||||||
const target = targetSelector ? SelectorEngine.findOne(targetSelector) : null
|
const target = targetSelector ? SelectorEngine.findOne(targetSelector) : null
|
||||||
|
|
||||||
@@ -128,7 +127,9 @@ class ScrollSpy extends BaseComponent {
|
|||||||
return null
|
return null
|
||||||
})
|
})
|
||||||
.filter(item => item)
|
.filter(item => item)
|
||||||
.sort((a, b) => a[0] - b[0])) {
|
.sort((a, b) => a[0] - b[0])
|
||||||
|
|
||||||
|
for (const item of targets) {
|
||||||
this._offsets.push(item[0])
|
this._offsets.push(item[0])
|
||||||
this._targets.push(item[1])
|
this._targets.push(item[1])
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user