(hash)
| 5385 | } |
| 5386 | |
| 5387 | function scroll(hash) { |
| 5388 | // Allow numeric hashes |
| 5389 | hash = isString(hash) ? hash : isNumber(hash) ? hash.toString() : $location.hash(); |
| 5390 | var elm; |
| 5391 | |
| 5392 | // empty hash, scroll to the top of the page |
| 5393 | if (!hash) scrollTo(null); |
| 5394 | |
| 5395 | // element with given id |
| 5396 | else if ((elm = document.getElementById(hash))) scrollTo(elm); |
| 5397 | |
| 5398 | // first anchor with given name :-D |
| 5399 | else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) scrollTo(elm); |
| 5400 | |
| 5401 | // no element and hash === 'top', scroll to the top of the page |
| 5402 | else if (hash === 'top') scrollTo(null); |
| 5403 | } |
| 5404 | |
| 5405 | // does not scroll when user clicks on anchor link that is currently on |
| 5406 | // (no url change, no $location.hash() change), browser native does scroll |
nothing calls this directly
no test coverage detected