bbc1d12f by Michael Richards

Skip all nodes in an iteration context unless building the views for the iterated items.

1 parent b0cb46e2
......@@ -114,13 +114,27 @@ class Rivets.View
# Builds the Rivets.Binding instances for the view.
build: =>
@bindings = []
skipNodes = []
iterator = null
bindingRegExp = @bindingRegExp()
eventRegExp = /^on-/
iterationRegExp = /^each-/
parseNode = (node) =>
unless node in skipNodes
for attribute in node.attributes
if bindingRegExp.test attribute.name
type = attribute.name.replace bindingRegExp, ''
if iterationRegExp.test type
unless @models[type.replace iterationRegExp, '']
skipNodes.push n for n in node.getElementsByTagName '*'
iterator = [attribute]
for attribute in iterator or node.attributes
iterator = null
if bindingRegExp.test attribute.name
options = {}
type = attribute.name.replace bindingRegExp, ''
......