 historyPushState = (state, title, url) ->
   window.history.pushState state, title, url
   historyState = state
-
 
 
 browserSupportsPushState =

  xhr.setRequestHeader 'X-Push-State-Referer', referer

  xhr.onload  = ->
    checkHeaders xhr
    changePage extractTitleAndBody(xhr.responseText)...
    triggerEvent 'page:load'
  xhr.onabort = -> console.log 'Aborted turbolink fetch!'
  xhr.send()

noTurbolink = (link) ->
  link.getAttribute('data-no-turbolink')?

nonStandardClick = (event) ->
  event.which > 1 or event.metaKey or event.ctrlKey or event.shiftKey or event.altKey

ignoreClick = (event, link) ->
  crossOriginLink(link) or anchoredLink(link) or nonHtmlLink(link) or
  remoteLink(link)      or noTurbolink(link)  or nonStandardClick(event)

historyReplaceState = (state, title, url) ->
  window.history.replaceState state, title, url
