Use the @bindingRegExp function directly from inside @build.
Showing
2 changed files
with
5 additions
and
8 deletions
... | @@ -83,9 +83,8 @@ | ... | @@ -83,9 +83,8 @@ |
83 | }; | 83 | }; |
84 | 84 | ||
85 | View.prototype.build = function() { | 85 | View.prototype.build = function() { |
86 | var attribute, bindingRegExp, context, keypath, node, path, pipes, type, _i, _len, _ref, _results; | 86 | var attribute, context, keypath, node, path, pipes, type, _i, _len, _ref, _results; |
87 | this.bindings = []; | 87 | this.bindings = []; |
88 | bindingRegExp = this.bindingRegExp(); | ||
89 | _ref = this.el.getElementsByTagName('*'); | 88 | _ref = this.el.getElementsByTagName('*'); |
90 | _results = []; | 89 | _results = []; |
91 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { | 90 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { |
... | @@ -96,8 +95,8 @@ | ... | @@ -96,8 +95,8 @@ |
96 | _results1 = []; | 95 | _results1 = []; |
97 | for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { | 96 | for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { |
98 | attribute = _ref1[_j]; | 97 | attribute = _ref1[_j]; |
99 | if (bindingRegExp.test(attribute.name)) { | 98 | if (this.bindingRegExp().test(attribute.name)) { |
100 | type = attribute.name.replace(bindingRegExp, ''); | 99 | type = attribute.name.replace(this.bindingRegExp(), ''); |
101 | pipes = attribute.value.split('|').map(function(pipe) { | 100 | pipes = attribute.value.split('|').map(function(pipe) { |
102 | return pipe.trim(); | 101 | return pipe.trim(); |
103 | }); | 102 | }); | ... | ... |
... | @@ -51,12 +51,10 @@ class Rivets.View | ... | @@ -51,12 +51,10 @@ class Rivets.View |
51 | build: => | 51 | build: => |
52 | @bindings = [] | 52 | @bindings = [] |
53 | 53 | ||
54 | bindingRegExp = @bindingRegExp() | ||
55 | |||
56 | for node in @el.getElementsByTagName '*' | 54 | for node in @el.getElementsByTagName '*' |
57 | for attribute in node.attributes | 55 | for attribute in node.attributes |
58 | if bindingRegExp.test attribute.name | 56 | if @bindingRegExp().test attribute.name |
59 | type = attribute.name.replace bindingRegExp, '' | 57 | type = attribute.name.replace @bindingRegExp(), '' |
60 | pipes = attribute.value.split('|').map (pipe) -> pipe.trim() | 58 | pipes = attribute.value.split('|').map (pipe) -> pipe.trim() |
61 | path = pipes.shift().split '.' | 59 | path = pipes.shift().split '.' |
62 | context = @contexts[path.shift()] | 60 | context = @contexts[path.shift()] | ... | ... |
-
Please register or sign in to post a comment