filter out non matches in map

This commit is contained in:
Jacob Thornton 2012-03-21 23:59:27 -07:00
parent 20e085723b
commit b3bf223617
3 changed files with 4 additions and 4 deletions

Binary file not shown.

View File

@ -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 () {

View File

@ -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 () {