Build 0.3.4.
Showing
4 changed files
with
22 additions
and
35 deletions
1 | // rivets.js | 1 | // rivets.js |
2 | // version: 0.3.3 | 2 | // version: 0.3.4 |
3 | // author: Michael Richards | 3 | // author: Michael Richards |
4 | // license: MIT | 4 | // license: MIT |
5 | (function() { | 5 | (function() { |
... | @@ -163,7 +163,7 @@ | ... | @@ -163,7 +163,7 @@ |
163 | }; | 163 | }; |
164 | 164 | ||
165 | View.prototype.build = function() { | 165 | View.prototype.build = function() { |
166 | var bindingRegExp, classRegExp, el, eventRegExp, iterationRegExp, iterator, node, parseNode, skipNodes, _i, _len, _ref, _results, | 166 | var bindingRegExp, classRegExp, el, eventRegExp, iterationRegExp, iterator, node, parseNode, skipNodes, _i, _j, _len, _len1, _ref, _ref1, |
167 | _this = this; | 167 | _this = this; |
168 | this.bindings = []; | 168 | this.bindings = []; |
169 | skipNodes = []; | 169 | skipNodes = []; |
... | @@ -173,7 +173,7 @@ | ... | @@ -173,7 +173,7 @@ |
173 | classRegExp = /^class-/; | 173 | classRegExp = /^class-/; |
174 | iterationRegExp = /^each-/; | 174 | iterationRegExp = /^each-/; |
175 | parseNode = function(node) { | 175 | parseNode = function(node) { |
176 | var a, attribute, binding, context, ctx, dependencies, keypath, model, n, options, path, pipe, pipes, splitPath, type, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2, _results; | 176 | var a, attribute, binding, context, ctx, dependencies, keypath, model, n, options, path, pipe, pipes, splitPath, type, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2; |
177 | if (__indexOf.call(skipNodes, node) < 0) { | 177 | if (__indexOf.call(skipNodes, node) < 0) { |
178 | _ref = node.attributes; | 178 | _ref = node.attributes; |
179 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { | 179 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { |
... | @@ -193,31 +193,30 @@ | ... | @@ -193,31 +193,30 @@ |
193 | } | 193 | } |
194 | } | 194 | } |
195 | _ref2 = iterator || node.attributes; | 195 | _ref2 = iterator || node.attributes; |
196 | _results = []; | ||
197 | for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) { | 196 | for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) { |
198 | attribute = _ref2[_k]; | 197 | attribute = _ref2[_k]; |
199 | if (bindingRegExp.test(attribute.name)) { | 198 | if (bindingRegExp.test(attribute.name)) { |
200 | options = {}; | 199 | options = {}; |
201 | type = attribute.name.replace(bindingRegExp, ''); | 200 | type = attribute.name.replace(bindingRegExp, ''); |
202 | pipes = (function() { | 201 | pipes = (function() { |
203 | var _l, _len3, _ref3, _results1; | 202 | var _l, _len3, _ref3, _results; |
204 | _ref3 = attribute.value.split('|'); | 203 | _ref3 = attribute.value.split('|'); |
205 | _results1 = []; | 204 | _results = []; |
206 | for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) { | 205 | for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) { |
207 | pipe = _ref3[_l]; | 206 | pipe = _ref3[_l]; |
208 | _results1.push(pipe.trim()); | 207 | _results.push(pipe.trim()); |
209 | } | 208 | } |
210 | return _results1; | 209 | return _results; |
211 | })(); | 210 | })(); |
212 | context = (function() { | 211 | context = (function() { |
213 | var _l, _len3, _ref3, _results1; | 212 | var _l, _len3, _ref3, _results; |
214 | _ref3 = pipes.shift().split('>'); | 213 | _ref3 = pipes.shift().split('<'); |
215 | _results1 = []; | 214 | _results = []; |
216 | for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) { | 215 | for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) { |
217 | ctx = _ref3[_l]; | 216 | ctx = _ref3[_l]; |
218 | _results1.push(ctx.trim()); | 217 | _results.push(ctx.trim()); |
219 | } | 218 | } |
220 | return _results1; | 219 | return _results; |
221 | })(); | 220 | })(); |
222 | path = context.shift(); | 221 | path = context.shift(); |
223 | splitPath = path.split(/\.|:/); | 222 | splitPath = path.split(/\.|:/); |
... | @@ -251,31 +250,21 @@ | ... | @@ -251,31 +250,21 @@ |
251 | a = iterator[_l]; | 250 | a = iterator[_l]; |
252 | node.removeAttribute(a.name); | 251 | node.removeAttribute(a.name); |
253 | } | 252 | } |
254 | _results.push(iterator = null); | 253 | iterator = null; |
255 | } else { | ||
256 | _results.push(void 0); | ||
257 | } | 254 | } |
258 | } | 255 | } |
259 | return _results; | ||
260 | } | 256 | } |
261 | }; | 257 | }; |
262 | _ref = this.els; | 258 | _ref = this.els; |
263 | _results = []; | ||
264 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { | 259 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { |
265 | el = _ref[_i]; | 260 | el = _ref[_i]; |
266 | parseNode(el); | 261 | parseNode(el); |
267 | _results.push((function() { | 262 | _ref1 = el.getElementsByTagName('*'); |
268 | var _j, _len1, _ref1, _results1; | 263 | for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { |
269 | _ref1 = el.getElementsByTagName('*'); | 264 | node = _ref1[_j]; |
270 | _results1 = []; | 265 | parseNode(node); |
271 | for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { | 266 | } |
272 | node = _ref1[_j]; | ||
273 | _results1.push(parseNode(node)); | ||
274 | } | ||
275 | return _results1; | ||
276 | })()); | ||
277 | } | 267 | } |
278 | return _results; | ||
279 | }; | 268 | }; |
280 | 269 | ||
281 | View.prototype.bind = function() { | 270 | View.prototype.bind = function() { |
... | @@ -454,16 +443,14 @@ | ... | @@ -454,16 +443,14 @@ |
454 | formatters: Rivets.formatters, | 443 | formatters: Rivets.formatters, |
455 | config: Rivets.config, | 444 | config: Rivets.config, |
456 | configure: function(options) { | 445 | configure: function(options) { |
457 | var property, value, _results; | 446 | var property, value; |
458 | if (options == null) { | 447 | if (options == null) { |
459 | options = {}; | 448 | options = {}; |
460 | } | 449 | } |
461 | _results = []; | ||
462 | for (property in options) { | 450 | for (property in options) { |
463 | value = options[property]; | 451 | value = options[property]; |
464 | _results.push(Rivets.config[property] = value); | 452 | Rivets.config[property] = value; |
465 | } | 453 | } |
466 | return _results; | ||
467 | }, | 454 | }, |
468 | bind: function(el, models) { | 455 | bind: function(el, models) { |
469 | var view; | 456 | var view; | ... | ... |
This diff is collapsed.
Click to expand it.
1 | { | 1 | { |
2 | "name" : "rivets", | 2 | "name" : "rivets", |
3 | "description" : "Declarative data binding facility.", | 3 | "description" : "Declarative data binding facility.", |
4 | "version" : "0.3.3", | 4 | "version" : "0.3.4", |
5 | "author" : "Michael Richards", | 5 | "author" : "Michael Richards", |
6 | "url" : "http://rivetsjs.com", | 6 | "url" : "http://rivetsjs.com", |
7 | "main" : "./lib/rivets.js", | 7 | "main" : "./lib/rivets.js", | ... | ... |
-
Please register or sign in to post a comment