   xhr.onabort = -> console.log("Aborted turbolink fetch!")
   xhr.send()
 
+fetchHistory = (url) ->
+  while(historyCache.length > 0)
+    cache = historyCache.pop()
+    if cache.url == url
+      replaceHTML cache.html
+      triggerPageChange
+      return
+
+  fetchReplacement url
+
 fullReplacement = (html, url) ->
-  replaceHTML html
+  replaceHTML html, "cache"
   triggerPageChange()
 
 reflectNewUrl = (url) ->

  else
    createDocumentUsingWrite

replaceHTML = (html) ->
  doc = createDocument html
  originalBody = document.body
  document.documentElement.appendChild doc.body, originalBody
  document.documentElement.removeChild originalBody
  document.title = title.textContent if title = doc.querySelector "title"


extractLink = (event) ->


if browserSupportsPushState
  rememberInitialPage()

  window.addEventListener 'popstate', (event) ->
    if event.state?.turbolinks
      fetchHistory document.location.href

  document.addEventListener 'click', (event) ->
    handleClick event
