Don't compile the bindingRegExp more times than needed
Showing
1 changed file
with
3 additions
and
2 deletions
... | @@ -51,11 +51,12 @@ class Rivets.View | ... | @@ -51,11 +51,12 @@ class Rivets.View |
51 | # Builds the Rivets.Binding instances for the view. | 51 | # Builds the Rivets.Binding instances for the view. |
52 | build: => | 52 | build: => |
53 | @bindings = [] | 53 | @bindings = [] |
54 | bindingRegExp = @bindingRegExp() | ||
54 | 55 | ||
55 | for node in @el.getElementsByTagName '*' | 56 | for node in @el.getElementsByTagName '*' |
56 | for attribute in node.attributes | 57 | for attribute in node.attributes |
57 | if @bindingRegExp().test attribute.name | 58 | if bindingRegExp.test attribute.name |
58 | type = attribute.name.replace @bindingRegExp(), '' | 59 | type = attribute.name.replace bindingRegExp, '' |
59 | pipes = attribute.value.split('|').map (pipe) -> pipe.trim() | 60 | pipes = attribute.value.split('|').map (pipe) -> pipe.trim() |
60 | path = pipes.shift().split '.' | 61 | path = pipes.shift().split '.' |
61 | model = @models[path.shift()] | 62 | model = @models[path.shift()] | ... | ... |
-
Please register or sign in to post a comment