   popCookie('request_method') in ['GET','']
 
 browserSupportsTurbolinks = browserSupportsPushState and browserIsntBuggy and requestMethodIsSafe
+
+browserSupportsCustomEvents =
+  document.addEventListener and document.createEvent
 
 installDocumentReadyPageEventTriggers()
 installJqueryAjaxSuccessPageUpdateTrigger()

  htmlExtensions

installDocumentReadyPageEventTriggers = ->
  document.addEventListener 'DOMContentLoaded', ( ->
    triggerEvent 'page:change'
    triggerEvent 'page:update'
  ), true

installJqueryAjaxSuccessPageUpdateTrigger = ->
  if typeof jQuery isnt 'undefined'
    jQuery(document).on 'ajaxSuccess', (event, xhr, settings) ->
      return unless jQuery.trim xhr.responseText
      triggerEvent 'page:update'

xhr            = null


fetchReplacement = (url) ->
  rememberReferer()
  cacheCurrentPage()
  triggerEvent 'page:fetch', url: url
