(hash)
| 4883 | } |
| 4884 | |
| 4885 | function scroll(hash) { |
| 4886 | hash = isString(hash) ? hash : $location.hash(); |
| 4887 | var elm; |
| 4888 | |
| 4889 | // empty hash, scroll to the top of the page |
| 4890 | if (!hash) scrollTo(null); |
| 4891 | // element with given id |
| 4892 | else if ((elm = document.getElementById(hash))) scrollTo(elm); |
| 4893 | // first anchor with given name :-D |
| 4894 | else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) scrollTo(elm); |
| 4895 | // no element and hash == 'top', scroll to the top of the page |
| 4896 | else if (hash === 'top') scrollTo(null); |
| 4897 | } |
| 4898 | |
| 4899 | // does not scroll when user clicks on anchor link that is currently on |
| 4900 | // (no url change, no $location.hash() change), browser native does scroll |
nothing calls this directly
no test coverage detected