       triggerEvent 'page:before-replace'
       document.documentElement.replaceChild body, document.body
       CSRFToken.update csrfToken if csrfToken?
+      setAutofocusElement()
       executeScriptTags() if runScripts
       currentState = window.history.state
       triggerEvent 'page:change'

      matchingNodes.push(node)

    return matchingNodes

  deleteRefreshNeverNodes = (body) ->
    for node in body.querySelectorAll('[refresh-never]')


  @loadPage: (url, xhr, partialReplace = false, onLoadFunction = (->), replaceContents = [], replaceAllExcept = []) ->
    triggerEvent 'page:receive'

    if doc = processResponse(xhr, partialReplace)
      reflectNewUrl url
