8d1ea999 by Terrance A. Snyder

each-* will now check for null on null array [Closes #110]

1 parent 835f5406
...@@ -339,17 +339,18 @@ Rivets.binders = ...@@ -339,17 +339,18 @@ Rivets.binders =
339 339
340 @iterated = [] 340 @iterated = []
341 341
342 for item in collection 342 if collection
343 data = {} 343 for item in collection
344 data[n] = m for n, m of @view.models 344 data = {}
345 data[@args[0]] = item 345 data[n] = m for n, m of @view.models
346 itemEl = el.cloneNode true 346 data[@args[0]] = item
347 if @iterated.length > 0 347 itemEl = el.cloneNode true
348 previous = @iterated[@iterated.length - 1].els[0] 348 if @iterated.length > 0
349 else 349 previous = @iterated[@iterated.length - 1].els[0]
350 previous = @marker 350 else
351 @marker.parentNode.insertBefore itemEl, previous.nextSibling ? null 351 previous = @marker
352 @iterated.push rivets.bind itemEl, data 352 @marker.parentNode.insertBefore itemEl, previous.nextSibling ? null
353 @iterated.push rivets.bind itemEl, data
353 354
354 "class-*": (el, value) -> 355 "class-*": (el, value) ->
355 elClass = " #{el.className} " 356 elClass = " #{el.className} "
......