-historyCache = []
+window.historyCache = []
 visit = (url) ->
   if browserSupportsPushState?
     reflectNewUrl url

  document.documentElement.appendChild doc.body, originalBody
  document.documentElement.removeChild originalBody
  document.title = title.textContent if title = doc.querySelector "title"
  historyCache.push({url: document.location.href, html:html}) if cache


extractLink = (event) ->

  xhr.send()

fetchHistory = (url) ->
  while(window.historyCache.length > 0)
    cache = window.historyCache.pop()
    if cache.url == url
      replaceHTML cache.html
      triggerPageChange
