(hash)
| 4739 | } |
| 4740 | |
| 4741 | function scroll(hash) { |
| 4742 | hash = isString(hash) ? hash : $location.hash(); |
| 4743 | var elm; |
| 4744 | |
| 4745 | // empty hash, scroll to the top of the page |
| 4746 | if (!hash) scrollTo(null); |
| 4747 | |
| 4748 | // element with given id |
| 4749 | else if ((elm = document.getElementById(hash))) scrollTo(elm); |
| 4750 | |
| 4751 | // first anchor with given name :-D |
| 4752 | else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) scrollTo(elm); |
| 4753 | |
| 4754 | // no element and hash == 'top', scroll to the top of the page |
| 4755 | else if (hash === 'top') scrollTo(null); |
| 4756 | } |
| 4757 | |
| 4758 | // does not scroll when user clicks on anchor link that is currently on |
| 4759 | // (no url change, no $location.hash() change), browser native does scroll |
nothing calls this directly
no test coverage detected