* The event handler is fully loaded document * * @param {*} [noScroll] * @return void
(noScroll)
| 916 | * @return void |
| 917 | */ |
| 918 | function onLoad(noScroll) { |
| 919 | // Get rid of the events popstate when the first loading a document in the webkit browsers |
| 920 | setTimeout(function() { |
| 921 | // hang up the event handler for the built-in popstate event in the browser |
| 922 | addEvent('popstate', function(e) { |
| 923 | // set the current url, that suppress the creation of the popstate event by changing the hash |
| 924 | checkUrlForPopState = windowLocation.href; |
| 925 | // for Safari browser in OS Windows not implemented 'state' object in 'History' interface |
| 926 | // and not implemented in old HTML4 browsers |
| 927 | if (!isSupportStateObjectInHistory) { |
| 928 | e = redefineProperty(e, 'state', {get: function() { |
| 929 | return historyObject.state; |
| 930 | }}); |
| 931 | } |
| 932 | // send events to be processed |
| 933 | dispatchEvent(e); |
| 934 | }, false); |
| 935 | }, 0); |
| 936 | // for non-HTML5 browsers |
| 937 | if (!isSupportHistoryAPI && noScroll !== true && "location" in historyObject) { |
| 938 | // scroll window to anchor element |
| 939 | scrollToAnchorId(locationObject.hash); |
| 940 | // fire initial state for non-HTML5 browser after load page |
| 941 | fireInitialState(); |
| 942 | } |
| 943 | } |
| 944 | |
| 945 | /** |
| 946 | * Finds the closest ancestor anchor element (including the target itself). |
no test coverage detected