(hash)
| 5361 | } |
| 5362 | |
| 5363 | function scroll(hash) { |
| 5364 | // Allow numeric hashes |
| 5365 | hash = isString(hash) ? hash : isNumber(hash) ? hash.toString() : $location.hash(); |
| 5366 | var elm; |
| 5367 | |
| 5368 | // empty hash, scroll to the top of the page |
| 5369 | if (!hash) scrollTo(null); |
| 5370 | |
| 5371 | // element with given id |
| 5372 | else if ((elm = document.getElementById(hash))) scrollTo(elm); |
| 5373 | |
| 5374 | // first anchor with given name :-D |
| 5375 | else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) scrollTo(elm); |
| 5376 | |
| 5377 | // no element and hash === 'top', scroll to the top of the page |
| 5378 | else if (hash === 'top') scrollTo(null); |
| 5379 | } |
| 5380 | |
| 5381 | // does not scroll when user clicks on anchor link that is currently on |
| 5382 | // (no url change, no $location.hash() change), browser native does scroll |
nothing calls this directly
no test coverage detected