(hash)
| 5039 | } |
| 5040 | |
| 5041 | function scroll(hash) { |
| 5042 | // Allow numeric hashes |
| 5043 | hash = isString(hash) ? hash : isNumber(hash) ? hash.toString() : $location.hash(); |
| 5044 | var elm; |
| 5045 | |
| 5046 | // empty hash, scroll to the top of the page |
| 5047 | if (!hash) scrollTo(null); |
| 5048 | |
| 5049 | // element with given id |
| 5050 | else if ((elm = document.getElementById(hash))) scrollTo(elm); |
| 5051 | |
| 5052 | // first anchor with given name :-D |
| 5053 | else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) scrollTo(elm); |
| 5054 | |
| 5055 | // no element and hash === 'top', scroll to the top of the page |
| 5056 | else if (hash === 'top') scrollTo(null); |
| 5057 | } |
| 5058 | |
| 5059 | // does not scroll when user clicks on anchor link that is currently on |
| 5060 | // (no url change, no $location.hash() change), browser native does scroll |
nothing calls this directly
no test coverage detected