   location.protocol isnt link.protocol or location.host isnt link.host
 
 anchoredLink = (link) ->
-  ((link.hash and link.href.replace(link.hash, '')) is location.href.replace(location.hash, '')) or
+  ((link.hash and removeHash(link)) is removeHash(location)) or
     (link.href is location.href + '#')
 
 nonHtmlLink = (link) ->

  triggerEvent 'page:fetch'

  xhr = new XMLHttpRequest
  xhr.open 'GET', url, true
  xhr.setRequestHeader 'Accept', 'text/html, application/xhtml+xml, application/xml'
  xhr.setRequestHeader 'X-XHR-Referer', referer


resetScrollPosition = ->
  window.scrollTo 0, 0

removeHash = (url) ->
  link = url
  unless url.href?
    link = document.createElement 'A'
    link.href = url
  link.href.replace link.hash, ''


triggerEvent = (name) ->
  event = document.createEvent 'Events'
