(hash)
| 4831 | } |
| 4832 | |
| 4833 | function scroll(hash) { |
| 4834 | hash = isString(hash) ? hash : $location.hash(); |
| 4835 | var elm; |
| 4836 | |
| 4837 | // empty hash, scroll to the top of the page |
| 4838 | if (!hash) scrollTo(null); |
| 4839 | |
| 4840 | // element with given id |
| 4841 | else if ((elm = document.getElementById(hash))) scrollTo(elm); |
| 4842 | |
| 4843 | // first anchor with given name :-D |
| 4844 | else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) scrollTo(elm); |
| 4845 | |
| 4846 | // no element and hash == 'top', scroll to the top of the page |
| 4847 | else if (hash === 'top') scrollTo(null); |
| 4848 | } |
| 4849 | |
| 4850 | // does not scroll when user clicks on anchor link that is currently on |
| 4851 | // (no url change, no $location.hash() change), browser native does scroll |
nothing calls this directly
no test coverage detected