 rememberInitialPage = ->
   window.history.replaceState { turbolinks: true }, "", document.location.href
 
-
 if browserSupportsPushState
   rememberInitialPage()
 


replaceDocument = (body,title,cache) ->
  originalBody = document.body
  document.documentElement.appendChild body.cloneNode(true), originalBody
  document.documentElement.removeChild originalBody
  document.title = title
  window.historyCache.push({url: document.location.href, title:title,body:body}) if cache


extractLink = (event) ->

@historyCache = []

visit = (url) ->
  if browserSupportsPushState?
    @historyCache.push({url:document.location.href,body:document.body,title:document.title})
    reflectNewUrl url
    fetchReplacement url
  else
