()
| 4038 | } |
| 4039 | |
| 4040 | function scroll() { |
| 4041 | var hash = $location.hash(), elm; |
| 4042 | |
| 4043 | // empty hash, scroll to the top of the page |
| 4044 | if (!hash) $window.scrollTo(0, 0); |
| 4045 | |
| 4046 | // element with given id |
| 4047 | else if ((elm = document.getElementById(hash))) elm.scrollIntoView(); |
| 4048 | |
| 4049 | // first anchor with given name :-D |
| 4050 | else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) elm.scrollIntoView(); |
| 4051 | |
| 4052 | // no element and hash == 'top', scroll to the top of the page |
| 4053 | else if (hash === 'top') $window.scrollTo(0, 0); |
| 4054 | } |
| 4055 | |
| 4056 | // does not scroll when user clicks on anchor link that is currently on |
| 4057 | // (no url change, no $location.hash() change), browser native does scroll |
nothing calls this directly
no test coverage detected