(hash)
| 5411 | } |
| 5412 | |
| 5413 | function scroll(hash) { |
| 5414 | // Allow numeric hashes |
| 5415 | hash = isString(hash) ? hash : isNumber(hash) ? hash.toString() : $location.hash(); |
| 5416 | var elm; |
| 5417 | |
| 5418 | // empty hash, scroll to the top of the page |
| 5419 | if (!hash) scrollTo(null); |
| 5420 | |
| 5421 | // element with given id |
| 5422 | else if ((elm = document.getElementById(hash))) scrollTo(elm); |
| 5423 | |
| 5424 | // first anchor with given name :-D |
| 5425 | else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) scrollTo(elm); |
| 5426 | |
| 5427 | // no element and hash === 'top', scroll to the top of the page |
| 5428 | else if (hash === 'top') scrollTo(null); |
| 5429 | } |
| 5430 | |
| 5431 | // does not scroll when user clicks on anchor link that is currently on |
| 5432 | // (no url change, no $location.hash() change), browser native does scroll |
nothing calls this directly
no test coverage detected