()
| 2964 | } |
| 2965 | |
| 2966 | function scroll() { |
| 2967 | var hash = $location.hash(), elm; |
| 2968 | |
| 2969 | // empty hash, scroll to the top of the page |
| 2970 | if (!hash) $window.scrollTo(0, 0); |
| 2971 | |
| 2972 | // element with given id |
| 2973 | else if ((elm = document.getElementById(hash))) elm.scrollIntoView(); |
| 2974 | |
| 2975 | // first anchor with given name :-D |
| 2976 | else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) elm.scrollIntoView(); |
| 2977 | |
| 2978 | // no element and hash == 'top', scroll to the top of the page |
| 2979 | else if (hash === 'top') $window.scrollTo(0, 0); |
| 2980 | } |
| 2981 | |
| 2982 | // does not scroll when user clicks on anchor link that is currently on |
| 2983 | // (no url change, no $location.hash() change), browser native does scroll |
nothing calls this directly
no test coverage detected