Re-use the Regexp object from @bindingRegExp() instead of creating a new one for…
… each iteration; remove the unused dataRegExp variable.
Showing
1 changed file
with
4 additions
and
3 deletions
... | @@ -51,11 +51,12 @@ class Rivets.View | ... | @@ -51,11 +51,12 @@ class Rivets.View |
51 | build: => | 51 | build: => |
52 | @bindings = [] | 52 | @bindings = [] |
53 | 53 | ||
54 | bindingRegExp = @bindingRegExp() | ||
55 | |||
54 | for node in @el.getElementsByTagName '*' | 56 | for node in @el.getElementsByTagName '*' |
55 | for attribute in node.attributes | 57 | for attribute in node.attributes |
56 | dataRegExp = new RegExp(@data, 'g') | 58 | if bindingRegExp.test attribute.name |
57 | if @bindingRegExp().test attribute.name | 59 | type = attribute.name.replace bindingRegExp, '' |
58 | 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 | context = @contexts[path.shift()] | 62 | context = @contexts[path.shift()] | ... | ... |
-
Please register or sign in to post a comment