0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-11-29 11:24:18 +01:00

scrollspy.js: minor refactoring

This commit is contained in:
XhmikosR 2020-06-20 19:07:20 +03:00
parent f15af45c6e
commit b97fcd3289

View File

@ -113,18 +113,13 @@ class ScrollSpy {
this._offsets = [] this._offsets = []
this._targets = [] this._targets = []
this._scrollHeight = this._getScrollHeight() this._scrollHeight = this._getScrollHeight()
const targets = SelectorEngine.find(this._selector) const targets = SelectorEngine.find(this._selector)
targets.map(element => { targets.map(element => {
let target
const targetSelector = getSelectorFromElement(element) const targetSelector = getSelectorFromElement(element)
const target = targetSelector ? SelectorEngine.findOne(targetSelector) : null
if (targetSelector) {
target = SelectorEngine.findOne(targetSelector)
}
if (target) { if (target) {
const targetBCR = target.getBoundingClientRect() const targetBCR = target.getBoundingClientRect()