   triggerEvent EVENTS.CHANGE
   triggerEvent EVENTS.UPDATE
 
-refreshAllExceptWithKeys = (keys, body) ->
+refreshAllExceptWithKeys = (keys, body, sourceBody) ->
   allNodesToKeep = []
 
   for key in keys
-    for node in document.querySelectorAll('[id^="'+key+'"]')
+    for node in sourceBody.querySelectorAll('[id^="'+key+'"]')
       allNodesToKeep.push(node)
 
   keepNodes(body, allNodesToKeep)

    if remoteNode = body.querySelector('[id="'+nodeId+'"]')
      remoteNode.parentNode.replaceChild(existingNode, remoteNode)

persistPermanentNodes = (body) ->
  allNodesToKeep = []

  nodes = document.querySelectorAll("[data-turbolinks-permanent]")
  allNodesToKeep.push(node) for node in nodes

  keepNodes(body, allNodesToKeep)
  return

getTemporaryNodes = ->
  node for node in document.querySelectorAll('[data-turbolinks-temporary]')

getPermanentNodes = ->
  node for node in document.querySelectorAll('[data-turbolinks-permanent]')

getNodesMatchingChangeKeys = (keys, body) ->
  matchingNodes = []

    document.location.href = document.location.href
  else
    window.scrollTo 0, 0

clone = (original) ->
  return original if not original? or typeof original isnt 'object'
