mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-16 10:34:07 +02:00
cache $(href) lookup
This commit is contained in:
Binary file not shown.
7
docs/assets/js/bootstrap-scrollspy.js
vendored
7
docs/assets/js/bootstrap-scrollspy.js
vendored
@@ -53,9 +53,10 @@
|
|||||||
.find(this.selector)
|
.find(this.selector)
|
||||||
.map(function () {
|
.map(function () {
|
||||||
var href = $(this).attr('href')
|
var href = $(this).attr('href')
|
||||||
return /^#\w/.test(href)
|
, $href = /^#\w/.test(href) && $(href)
|
||||||
&& $(href).length
|
return $href
|
||||||
&& [[ $(href).position().top, href ]]
|
&& href.length
|
||||||
|
&& [[ $href.position().top, href ]]
|
||||||
})
|
})
|
||||||
.sort(function (a, b) { return a[0] - b[0] })
|
.sort(function (a, b) { return a[0] - b[0] })
|
||||||
.each(function () {
|
.each(function () {
|
||||||
|
7
js/bootstrap-scrollspy.js
vendored
7
js/bootstrap-scrollspy.js
vendored
@@ -53,9 +53,10 @@
|
|||||||
.find(this.selector)
|
.find(this.selector)
|
||||||
.map(function () {
|
.map(function () {
|
||||||
var href = $(this).attr('href')
|
var href = $(this).attr('href')
|
||||||
return /^#\w/.test(href)
|
, $href = /^#\w/.test(href) && $(href)
|
||||||
&& $(href).length
|
return $href
|
||||||
&& [[ $(href).position().top, href ]]
|
&& href.length
|
||||||
|
&& [[ $href.position().top, href ]]
|
||||||
})
|
})
|
||||||
.sort(function (a, b) { return a[0] - b[0] })
|
.sort(function (a, b) { return a[0] - b[0] })
|
||||||
.each(function () {
|
.each(function () {
|
||||||
|
Reference in New Issue
Block a user