()
| 4476 | } |
| 4477 | |
| 4478 | function scroll() { |
| 4479 | var hash = $location.hash(), elm; |
| 4480 | |
| 4481 | // empty hash, scroll to the top of the page |
| 4482 | if (!hash) scrollTo(null); |
| 4483 | |
| 4484 | // element with given id |
| 4485 | else if ((elm = document.getElementById(hash))) scrollTo(elm); |
| 4486 | |
| 4487 | // first anchor with given name :-D |
| 4488 | else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) scrollTo(elm); |
| 4489 | |
| 4490 | // no element and hash == 'top', scroll to the top of the page |
| 4491 | else if (hash === 'top') scrollTo(null); |
| 4492 | } |
| 4493 | |
| 4494 | // does not scroll when user clicks on anchor link that is currently on |
| 4495 | // (no url change, no $location.hash() change), browser native does scroll |
nothing calls this directly
no test coverage detected