Commit 20e08572 authored by Jacob Thornton's avatar Jacob Thornton

cache $(href) lookup

parent 706ee46b
......@@ -53,9 +53,10 @@
.find(this.selector)
.map(function () {
var href = $(this).attr('href')
return /^#\w/.test(href)
&& $(href).length
&& [[ $(href).position().top, href ]]
, $href = /^#\w/.test(href) && $(href)
return $href
&& href.length
&& [[ $href.position().top, href ]]
})
.sort(function (a, b) { return a[0] - b[0] })
.each(function () {
......
......@@ -53,9 +53,10 @@
.find(this.selector)
.map(function () {
var href = $(this).attr('href')
return /^#\w/.test(href)
&& $(href).length
&& [[ $(href).position().top, href ]]
, $href = /^#\w/.test(href) && $(href)
return $href
&& href.length
&& [[ $href.position().top, href ]]
})
.sort(function (a, b) { return a[0] - b[0] })
.each(function () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment