Commit b3bf2236 authored by Jacob Thornton's avatar Jacob Thornton

filter out non matches in map

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