945ec9da by Michael Richards

Only perform the initial bind for each-* bindings once. Unbinding does not resto…

…re the initial node or remove the marker so el.parentNode is going to be null the second time around. [Closes #165]
1 parent 846ef080
......@@ -370,13 +370,14 @@ Rivets.binders =
block: true
bind: (el) ->
attr = ['data', @view.config.prefix, @type].join('-').replace '--', '-'
@marker = document.createComment " rivets: #{@type} "
@iterated = []
el.removeAttribute attr
el.parentNode.insertBefore @marker, el
el.parentNode.removeChild el
unless @marker?
attr = ['data', @view.config.prefix, @type].join('-').replace '--', '-'
@marker = document.createComment " rivets: #{@type} "
@iterated = []
el.removeAttribute attr
el.parentNode.insertBefore @marker, el
el.parentNode.removeChild el
unbind: (el) ->
view.unbind() for view in @iterated if @iterated?
......