 
     return
 
+  getNodesMatchingRefreshKeys = (keys) ->
+    matchingNodes = []
+    for key in keys
+      for node in document.querySelectorAll("[refresh=#{key}]")
+        matchingNodes.push(node)
+
+    return matchingNodes
+
+  getNodesWithRefreshAlways = ->
+    matchingNodes = []
+    for node in document.querySelectorAll("[refresh-always]")
+      matchingNodes.push(node)
+
+    return matchingNodes
+
   deleteRefreshNeverNodes = (body) ->
     for node in body.querySelectorAll('[refresh-never]')
       node.parentNode.removeChild(node)

  changePage = (title, body, csrfToken, runScripts, partialReplace, onlyKeys = [], exceptKeys = []) ->
    document.title = title if title

    refreshedNodes = []
    refreshedNodes = refreshRefreshAlwaysNodes(body)
    if onlyKeys.length
      refreshedNodes = refreshedNodes.concat refreshNodesWithKeys(onlyKeys, body)
      return refreshedNodes
    else
      persistStaticElements(body)
      if exceptKeys.length
        refreshAllExceptWithKeys(exceptKeys, body)

        existingNode.parentNode.removeChild(existingNode)

    refreshedNodes

  keepNodes = (body, allNodesToKeep) ->
    for existingNode in allNodesToKeep
