def update_binding_anchors!(nodes)
      new_bindings = {}

      @binding_anchors.each_pair do |name, anchors|
        new_name         = @@binding_number
        @@binding_number += 1

        if name.is_a?(String)
          if name[0..1] == 'id'
            # A generated id
            # update the id
            `anchors.setAttribute('id', 'id' + new_name);`

            new_bindings["id#{new_name}"] = @bindings[name]
          else
            # Assume a fixed id, should not be updated
            # TODO: Might want to check the page to see if a node
            # with this id already exists and raise if it does.

            # Copy from existing binding
            new_bindings[name] = @bindings[name]
          end
        else
          start_comment, end_comment = anchors

          `
            if (start_comment.textContent) {
              // direct update
              start_comment.textContent = " $" + new_name + " ";
              end_comment.textContent = " $/" + new_name + " ";
            } else if (start_comment.innerText) {
              start_comment.innerText = " $" + new_name + " ";
              end_comment.innerText = " $/" + new_name + " ";
            } else {
              // phantomjs doesn't work with textContent, so we replace the nodes
              // and update the references
              start_comment.nodeValue = " $" + new_name + " ";
              end_comment.nodeValue = " $/" + new_name + " ";
            }
          `

          # %x{
          #   start_comment.innerText = " $" + new_name + " ";
          #   end_comment.innerText = " $/" + new_name + " ";
          # }

          new_bindings[new_name] = @bindings[name]
        end
      end

      new_bindings
    end
def update_binding_anchors!(nodes)
      new_bindings = {}

      @binding_anchors.each_pair do |name, anchors|
        new_name         = @@binding_number
        @@binding_number += 1

        if name.is_a?(String)
          if name[0..1] == 'id'
            # A generated id
            # update the id
            `anchors.setAttribute('id', 'id' + new_name);`

            new_bindings["id#{new_name}"] = @bindings[name]
          else
            # Assume a fixed id, should not be updated
            # TODO: Might want to check the page to see if a node
            # with this id already exists and raise if it does.

            # Copy from existing binding
            new_bindings[name] = @bindings[name]
          end
        else
          start_comment, end_comment = anchors

          `
            if (start_comment.textContent) {
              // direct update
              start_comment.textContent = " $" + new_name + " ";
              end_comment.textContent = " $/" + new_name + " ";
            } else if (start_comment.innerText) {
              start_comment.innerText = " $" + new_name + " ";
              end_comment.innerText = " $/" + new_name + " ";
            } else {
              // phantomjs doesn't work with textContent, so we replace the nodes
              // and update the references
              start_comment.nodeValue = " $" + new_name + " ";
              end_comment.nodeValue = " $/" + new_name + " ";
            }
          `

          # %x{
          #   start_comment.innerText = " $" + new_name + " ";
          #   end_comment.innerText = " $/" + new_name + " ";
          # }

          new_bindings[new_name] = @bindings[name]
        end
      end

      new_bindings
    end
Takes the binding_anchors and updates them with new numbers (comments and id's)
 then returns the bindings updated to the new numbers.