Commit b3bf2236 authored by Jacob Thornton's avatar Jacob Thornton

filter out non matches in map

parent 20e08572
......@@ -54,9 +54,9 @@
.map(function () {
var href = $(this).attr('href')
, $href = /^#\w/.test(href) && $(href)
return $href
return ( $href
&& href.length
&& [[ $href.position().top, href ]]
&& [[ $href.position().top, href ]] ) || null
})
.sort(function (a, b) { return a[0] - b[0] })
.each(function () {
......
......@@ -54,9 +54,9 @@
.map(function () {
var href = $(this).attr('href')
, $href = /^#\w/.test(href) && $(href)
return $href
return ( $href
&& href.length
&& [[ $href.position().top, href ]]
&& [[ $href.position().top, href ]] ) || null
})
.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