()
| 4426 | } |
| 4427 | |
| 4428 | function scroll() { |
| 4429 | var hash = $location.hash(), elm; |
| 4430 | |
| 4431 | // empty hash, scroll to the top of the page |
| 4432 | if (!hash) scrollTo(null); |
| 4433 | |
| 4434 | // element with given id |
| 4435 | else if ((elm = document.getElementById(hash))) scrollTo(elm); |
| 4436 | |
| 4437 | // first anchor with given name :-D |
| 4438 | else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) scrollTo(elm); |
| 4439 | |
| 4440 | // no element and hash == 'top', scroll to the top of the page |
| 4441 | else if (hash === 'top') scrollTo(null); |
| 4442 | } |
| 4443 | |
| 4444 | // does not scroll when user clicks on anchor link that is currently on |
| 4445 | // (no url change, no $location.hash() change), browser native does scroll |
nothing calls this directly
no test coverage detected