()
| 4078 | } |
| 4079 | |
| 4080 | function scroll() { |
| 4081 | var hash = $location.hash(), elm; |
| 4082 | |
| 4083 | // empty hash, scroll to the top of the page |
| 4084 | if (!hash) $window.scrollTo(0, 0); |
| 4085 | |
| 4086 | // element with given id |
| 4087 | else if ((elm = document.getElementById(hash))) elm.scrollIntoView(); |
| 4088 | |
| 4089 | // first anchor with given name :-D |
| 4090 | else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) elm.scrollIntoView(); |
| 4091 | |
| 4092 | // no element and hash == 'top', scroll to the top of the page |
| 4093 | else if (hash === 'top') $window.scrollTo(0, 0); |
| 4094 | } |
| 4095 | |
| 4096 | // does not scroll when user clicks on anchor link that is currently on |
| 4097 | // (no url change, no $location.hash() change), browser native does scroll |
nothing calls this directly
no test coverage detected