(hash)
| 4871 | } |
| 4872 | |
| 4873 | function scroll(hash) { |
| 4874 | hash = isString(hash) ? hash : $location.hash(); |
| 4875 | var elm; |
| 4876 | |
| 4877 | // empty hash, scroll to the top of the page |
| 4878 | if (!hash) scrollTo(null); |
| 4879 | |
| 4880 | // element with given id |
| 4881 | else if ((elm = document.getElementById(hash))) scrollTo(elm); |
| 4882 | |
| 4883 | // first anchor with given name :-D |
| 4884 | else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) scrollTo(elm); |
| 4885 | |
| 4886 | // no element and hash == 'top', scroll to the top of the page |
| 4887 | else if (hash === 'top') scrollTo(null); |
| 4888 | } |
| 4889 | |
| 4890 | // does not scroll when user clicks on anchor link that is currently on |
| 4891 | // (no url change, no $location.hash() change), browser native does scroll |
nothing calls this directly
no test coverage detected