Merge branch 'master' into adapters
Showing
5 changed files
with
57 additions
and
76 deletions
... | @@ -2,7 +2,7 @@ | ... | @@ -2,7 +2,7 @@ |
2 | "name": "rivets", | 2 | "name": "rivets", |
3 | "repo": "mikeric/rivets", | 3 | "repo": "mikeric/rivets", |
4 | "description": "Declarative data binding facility.", | 4 | "description": "Declarative data binding facility.", |
5 | "version": "0.5.11", | 5 | "version": "0.5.12", |
6 | "keywords": ["data binding", "templating"], | 6 | "keywords": ["data binding", "templating"], |
7 | "scripts": ["dist/rivets.js"], | 7 | "scripts": ["dist/rivets.js"], |
8 | "main": "dist/rivets.js", | 8 | "main": "dist/rivets.js", | ... | ... |
1 | // Rivets.js | 1 | // Rivets.js |
2 | // version: 0.5.11 | 2 | // version: 0.5.12 |
3 | // author: Michael Richards | 3 | // author: Michael Richards |
4 | // license: MIT | 4 | // license: MIT |
5 | (function() { | 5 | (function() { |
... | @@ -21,7 +21,6 @@ | ... | @@ -21,7 +21,6 @@ |
21 | Rivets.Binding = (function() { | 21 | Rivets.Binding = (function() { |
22 | function Binding(view, el, type, key, keypath, options) { | 22 | function Binding(view, el, type, key, keypath, options) { |
23 | var identifier, regexp, value, _ref; | 23 | var identifier, regexp, value, _ref; |
24 | |||
25 | this.view = view; | 24 | this.view = view; |
26 | this.el = el; | 25 | this.el = el; |
27 | this.type = type; | 26 | this.type = type; |
... | @@ -36,7 +35,7 @@ | ... | @@ -36,7 +35,7 @@ |
36 | this.set = __bind(this.set, this); | 35 | this.set = __bind(this.set, this); |
37 | this.eventHandler = __bind(this.eventHandler, this); | 36 | this.eventHandler = __bind(this.eventHandler, this); |
38 | this.formattedValue = __bind(this.formattedValue, this); | 37 | this.formattedValue = __bind(this.formattedValue, this); |
39 | if (!(this.binder = Rivets.internalBinders[this.type] || this.view.binders[type])) { | 38 | if (!(this.binder = this.view.binders[type])) { |
40 | _ref = this.view.binders; | 39 | _ref = this.view.binders; |
41 | for (identifier in _ref) { | 40 | for (identifier in _ref) { |
42 | value = _ref[identifier]; | 41 | value = _ref[identifier]; |
... | @@ -62,7 +61,6 @@ | ... | @@ -62,7 +61,6 @@ |
62 | 61 | ||
63 | Binding.prototype.formattedValue = function(value) { | 62 | Binding.prototype.formattedValue = function(value) { |
64 | var args, formatter, id, _i, _len, _ref; | 63 | var args, formatter, id, _i, _len, _ref; |
65 | |||
66 | _ref = this.formatters; | 64 | _ref = this.formatters; |
67 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { | 65 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { |
68 | formatter = _ref[_i]; | 66 | formatter = _ref[_i]; |
... | @@ -80,7 +78,6 @@ | ... | @@ -80,7 +78,6 @@ |
80 | 78 | ||
81 | Binding.prototype.eventHandler = function(fn) { | 79 | Binding.prototype.eventHandler = function(fn) { |
82 | var binding, handler; | 80 | var binding, handler; |
83 | |||
84 | handler = (binding = this).view.config.handler; | 81 | handler = (binding = this).view.config.handler; |
85 | return function(ev) { | 82 | return function(ev) { |
86 | return handler.call(fn, this, ev, binding); | 83 | return handler.call(fn, this, ev, binding); |
... | @@ -89,7 +86,6 @@ | ... | @@ -89,7 +86,6 @@ |
89 | 86 | ||
90 | Binding.prototype.set = function(value) { | 87 | Binding.prototype.set = function(value) { |
91 | var _ref; | 88 | var _ref; |
92 | |||
93 | value = value instanceof Function && !this.binder["function"] ? this.formattedValue(value.call(this.model)) : this.formattedValue(value); | 89 | value = value instanceof Function && !this.binder["function"] ? this.formattedValue(value.call(this.model)) : this.formattedValue(value); |
94 | return (_ref = this.binder.routine) != null ? _ref.call(this, this.el, value) : void 0; | 90 | return (_ref = this.binder.routine) != null ? _ref.call(this, this.el, value) : void 0; |
95 | }; | 91 | }; |
... | @@ -100,7 +96,6 @@ | ... | @@ -100,7 +96,6 @@ |
100 | 96 | ||
101 | Binding.prototype.publish = function() { | 97 | Binding.prototype.publish = function() { |
102 | var args, formatter, id, value, _i, _len, _ref, _ref1, _ref2; | 98 | var args, formatter, id, value, _i, _len, _ref, _ref1, _ref2; |
103 | |||
104 | value = Rivets.Util.getInputValue(this.el); | 99 | value = Rivets.Util.getInputValue(this.el); |
105 | _ref = this.formatters.slice(0).reverse(); | 100 | _ref = this.formatters.slice(0).reverse(); |
106 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { | 101 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { |
... | @@ -116,7 +111,6 @@ | ... | @@ -116,7 +111,6 @@ |
116 | 111 | ||
117 | Binding.prototype.bind = function() { | 112 | Binding.prototype.bind = function() { |
118 | var dependency, keypath, model, _i, _len, _ref, _ref1, _ref2, _results; | 113 | var dependency, keypath, model, _i, _len, _ref, _ref1, _ref2, _results; |
119 | |||
120 | if ((_ref = this.binder.bind) != null) { | 114 | if ((_ref = this.binder.bind) != null) { |
121 | _ref.call(this, this.el); | 115 | _ref.call(this, this.el); |
122 | } | 116 | } |
... | @@ -149,7 +143,6 @@ | ... | @@ -149,7 +143,6 @@ |
149 | 143 | ||
150 | Binding.prototype.unbind = function() { | 144 | Binding.prototype.unbind = function() { |
151 | var dependency, keypath, model, _i, _len, _ref, _ref1, _ref2, _results; | 145 | var dependency, keypath, model, _i, _len, _ref, _ref1, _ref2, _results; |
152 | |||
153 | if ((_ref = this.binder.unbind) != null) { | 146 | if ((_ref = this.binder.unbind) != null) { |
154 | _ref.call(this, this.el); | 147 | _ref.call(this, this.el); |
155 | } | 148 | } |
... | @@ -177,7 +170,6 @@ | ... | @@ -177,7 +170,6 @@ |
177 | 170 | ||
178 | Binding.prototype.update = function(models) { | 171 | Binding.prototype.update = function(models) { |
179 | var _ref; | 172 | var _ref; |
180 | |||
181 | if (models == null) { | 173 | if (models == null) { |
182 | models = {}; | 174 | models = {}; |
183 | } | 175 | } |
... | @@ -211,7 +203,6 @@ | ... | @@ -211,7 +203,6 @@ |
211 | 203 | ||
212 | function ComponentBinding(view, el, type) { | 204 | function ComponentBinding(view, el, type) { |
213 | var attribute, _i, _len, _ref, _ref1; | 205 | var attribute, _i, _len, _ref, _ref1; |
214 | |||
215 | this.view = view; | 206 | this.view = view; |
216 | this.el = el; | 207 | this.el = el; |
217 | this.type = type; | 208 | this.type = type; |
... | @@ -236,8 +227,7 @@ | ... | @@ -236,8 +227,7 @@ |
236 | ComponentBinding.prototype.sync = function() {}; | 227 | ComponentBinding.prototype.sync = function() {}; |
237 | 228 | ||
238 | ComponentBinding.prototype.locals = function(models) { | 229 | ComponentBinding.prototype.locals = function(models) { |
239 | var inverse, key, model, path, result, _i, _len, _ref, _ref1, _ref2; | 230 | var inverse, key, model, path, result, _i, _len, _ref, _ref1; |
240 | |||
241 | if (models == null) { | 231 | if (models == null) { |
242 | models = this.view.models; | 232 | models = this.view.models; |
243 | } | 233 | } |
... | @@ -253,7 +243,7 @@ | ... | @@ -253,7 +243,7 @@ |
253 | } | 243 | } |
254 | for (key in models) { | 244 | for (key in models) { |
255 | model = models[key]; | 245 | model = models[key]; |
256 | if ((_ref2 = result[key]) == null) { | 246 | if (result[key] == null) { |
257 | result[key] = model; | 247 | result[key] = model; |
258 | } | 248 | } |
259 | } | 249 | } |
... | @@ -262,13 +252,11 @@ | ... | @@ -262,13 +252,11 @@ |
262 | 252 | ||
263 | ComponentBinding.prototype.update = function(models) { | 253 | ComponentBinding.prototype.update = function(models) { |
264 | var _ref; | 254 | var _ref; |
265 | |||
266 | return (_ref = this.componentView) != null ? _ref.update(this.locals(models)) : void 0; | 255 | return (_ref = this.componentView) != null ? _ref.update(this.locals(models)) : void 0; |
267 | }; | 256 | }; |
268 | 257 | ||
269 | ComponentBinding.prototype.bind = function() { | 258 | ComponentBinding.prototype.bind = function() { |
270 | var el, _ref; | 259 | var el, _ref; |
271 | |||
272 | if (this.componentView != null) { | 260 | if (this.componentView != null) { |
273 | return (_ref = this.componentView) != null ? _ref.bind() : void 0; | 261 | return (_ref = this.componentView) != null ? _ref.bind() : void 0; |
274 | } else { | 262 | } else { |
... | @@ -280,7 +268,6 @@ | ... | @@ -280,7 +268,6 @@ |
280 | 268 | ||
281 | ComponentBinding.prototype.unbind = function() { | 269 | ComponentBinding.prototype.unbind = function() { |
282 | var _ref; | 270 | var _ref; |
283 | |||
284 | return (_ref = this.componentView) != null ? _ref.unbind() : void 0; | 271 | return (_ref = this.componentView) != null ? _ref.unbind() : void 0; |
285 | }; | 272 | }; |
286 | 273 | ||
... | @@ -288,10 +275,38 @@ | ... | @@ -288,10 +275,38 @@ |
288 | 275 | ||
289 | })(Rivets.Binding); | 276 | })(Rivets.Binding); |
290 | 277 | ||
278 | Rivets.TextBinding = (function(_super) { | ||
279 | __extends(TextBinding, _super); | ||
280 | |||
281 | function TextBinding(view, el, type, key, keypath, options) { | ||
282 | this.view = view; | ||
283 | this.el = el; | ||
284 | this.type = type; | ||
285 | this.key = key; | ||
286 | this.keypath = keypath; | ||
287 | this.options = options != null ? options : {}; | ||
288 | this.sync = __bind(this.sync, this); | ||
289 | this.formatters = this.options.formatters || []; | ||
290 | this.model = this.key ? this.view.models[this.key] : this.view.models; | ||
291 | } | ||
292 | |||
293 | TextBinding.prototype.binder = { | ||
294 | routine: function(node, value) { | ||
295 | return node.data = value != null ? value : ''; | ||
296 | } | ||
297 | }; | ||
298 | |||
299 | TextBinding.prototype.sync = function() { | ||
300 | return TextBinding.__super__.sync.apply(this, arguments); | ||
301 | }; | ||
302 | |||
303 | return TextBinding; | ||
304 | |||
305 | })(Rivets.Binding); | ||
306 | |||
291 | Rivets.View = (function() { | 307 | Rivets.View = (function() { |
292 | function View(els, models, options) { | 308 | function View(els, models, options) { |
293 | var k, option, v, _base, _i, _len, _ref, _ref1, _ref2, _ref3; | 309 | var k, option, v, _base, _i, _len, _ref, _ref1, _ref2; |
294 | |||
295 | this.els = els; | 310 | this.els = els; |
296 | this.models = models; | 311 | this.models = models; |
297 | this.options = options != null ? options : {}; | 312 | this.options = options != null ? options : {}; |
... | @@ -321,7 +336,7 @@ | ... | @@ -321,7 +336,7 @@ |
321 | _ref2 = Rivets[option]; | 336 | _ref2 = Rivets[option]; |
322 | for (k in _ref2) { | 337 | for (k in _ref2) { |
323 | v = _ref2[k]; | 338 | v = _ref2[k]; |
324 | if ((_ref3 = (_base = this[option])[k]) == null) { | 339 | if ((_base = this[option])[k] == null) { |
325 | _base[k] = v; | 340 | _base[k] = v; |
326 | } | 341 | } |
327 | } | 342 | } |
... | @@ -331,7 +346,6 @@ | ... | @@ -331,7 +346,6 @@ |
331 | 346 | ||
332 | View.prototype.bindingRegExp = function() { | 347 | View.prototype.bindingRegExp = function() { |
333 | var prefix; | 348 | var prefix; |
334 | |||
335 | prefix = this.config.prefix; | 349 | prefix = this.config.prefix; |
336 | if (prefix) { | 350 | if (prefix) { |
337 | return new RegExp("^data-" + prefix + "-"); | 351 | return new RegExp("^data-" + prefix + "-"); |
... | @@ -342,25 +356,21 @@ | ... | @@ -342,25 +356,21 @@ |
342 | 356 | ||
343 | View.prototype.componentRegExp = function() { | 357 | View.prototype.componentRegExp = function() { |
344 | var _ref, _ref1; | 358 | var _ref, _ref1; |
345 | |||
346 | return new RegExp("^" + ((_ref = (_ref1 = this.config.prefix) != null ? _ref1.toUpperCase() : void 0) != null ? _ref : 'RV') + "-"); | 359 | return new RegExp("^" + ((_ref = (_ref1 = this.config.prefix) != null ? _ref1.toUpperCase() : void 0) != null ? _ref : 'RV') + "-"); |
347 | }; | 360 | }; |
348 | 361 | ||
349 | View.prototype.build = function() { | 362 | View.prototype.build = function() { |
350 | var bindingRegExp, buildBinding, componentRegExp, el, parse, skipNodes, _i, _len, _ref, | 363 | var bindingRegExp, buildBinding, componentRegExp, el, parse, skipNodes, _i, _len, _ref, |
351 | _this = this; | 364 | _this = this; |
352 | |||
353 | this.bindings = []; | 365 | this.bindings = []; |
354 | skipNodes = []; | 366 | skipNodes = []; |
355 | bindingRegExp = this.bindingRegExp(); | 367 | bindingRegExp = this.bindingRegExp(); |
356 | componentRegExp = this.componentRegExp(); | 368 | componentRegExp = this.componentRegExp(); |
357 | buildBinding = function(node, type, declaration) { | 369 | buildBinding = function(binding, node, type, declaration) { |
358 | var context, ctx, dependencies, key, keypath, options, path, pipe, pipes, splitPath; | 370 | var context, ctx, dependencies, key, keypath, options, path, pipe, pipes, splitPath; |
359 | |||
360 | options = {}; | 371 | options = {}; |
361 | pipes = (function() { | 372 | pipes = (function() { |
362 | var _i, _len, _ref, _results; | 373 | var _i, _len, _ref, _results; |
363 | |||
364 | _ref = declaration.split('|'); | 374 | _ref = declaration.split('|'); |
365 | _results = []; | 375 | _results = []; |
366 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { | 376 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { |
... | @@ -371,7 +381,6 @@ | ... | @@ -371,7 +381,6 @@ |
371 | })(); | 381 | })(); |
372 | context = (function() { | 382 | context = (function() { |
373 | var _i, _len, _ref, _results; | 383 | var _i, _len, _ref, _results; |
374 | |||
375 | _ref = pipes.shift().split('<'); | 384 | _ref = pipes.shift().split('<'); |
376 | _results = []; | 385 | _results = []; |
377 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { | 386 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { |
... | @@ -394,11 +403,10 @@ | ... | @@ -394,11 +403,10 @@ |
394 | if (dependencies = context.shift()) { | 403 | if (dependencies = context.shift()) { |
395 | options.dependencies = dependencies.split(/\s+/); | 404 | options.dependencies = dependencies.split(/\s+/); |
396 | } | 405 | } |
397 | return _this.bindings.push(new Rivets.Binding(_this, node, type, key, keypath, options)); | 406 | return _this.bindings.push(new Rivets[binding](_this, node, type, key, keypath, options)); |
398 | }; | 407 | }; |
399 | parse = function(node) { | 408 | parse = function(node) { |
400 | var attribute, attributes, binder, childNode, delimiters, identifier, n, parser, regexp, restTokens, startToken, text, token, tokens, type, value, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1, _ref2, _ref3, _ref4, _results; | 409 | var attribute, attributes, binder, childNode, delimiters, identifier, n, parser, regexp, restTokens, startToken, text, token, tokens, type, value, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1, _ref2, _ref3, _ref4, _results; |
401 | |||
402 | if (__indexOf.call(skipNodes, node) < 0) { | 410 | if (__indexOf.call(skipNodes, node) < 0) { |
403 | if (node.nodeType === Node.TEXT_NODE) { | 411 | if (node.nodeType === Node.TEXT_NODE) { |
404 | parser = Rivets.TextTemplateParser; | 412 | parser = Rivets.TextTemplateParser; |
... | @@ -407,18 +415,17 @@ | ... | @@ -407,18 +415,17 @@ |
407 | if (!(tokens.length === 1 && tokens[0].type === parser.types.text)) { | 415 | if (!(tokens.length === 1 && tokens[0].type === parser.types.text)) { |
408 | startToken = tokens[0], restTokens = 2 <= tokens.length ? __slice.call(tokens, 1) : []; | 416 | startToken = tokens[0], restTokens = 2 <= tokens.length ? __slice.call(tokens, 1) : []; |
409 | node.data = startToken.value; | 417 | node.data = startToken.value; |
410 | switch (startToken.type) { | 418 | if (startToken.type === 0) { |
411 | case 0: | 419 | node.data = startToken.value; |
412 | node.data = startToken.value; | 420 | } else { |
413 | break; | 421 | buildBinding('TextBinding', node, null, startToken.value); |
414 | case 1: | ||
415 | buildBinding(node, 'textNode', startToken.value); | ||
416 | } | 422 | } |
417 | for (_i = 0, _len = restTokens.length; _i < _len; _i++) { | 423 | for (_i = 0, _len = restTokens.length; _i < _len; _i++) { |
418 | token = restTokens[_i]; | 424 | token = restTokens[_i]; |
419 | node.parentNode.appendChild((text = document.createTextNode(token.value))); | 425 | text = document.createTextNode(token.value); |
426 | node.parentNode.appendChild(text); | ||
420 | if (token.type === 1) { | 427 | if (token.type === 1) { |
421 | buildBinding(text, 'textNode', token.value); | 428 | buildBinding('TextBinding', text, null, token.value); |
422 | } | 429 | } |
423 | } | 430 | } |
424 | } | 431 | } |
... | @@ -461,7 +468,7 @@ | ... | @@ -461,7 +468,7 @@ |
461 | attribute = _ref3[_l]; | 468 | attribute = _ref3[_l]; |
462 | if (bindingRegExp.test(attribute.name)) { | 469 | if (bindingRegExp.test(attribute.name)) { |
463 | type = attribute.name.replace(bindingRegExp, ''); | 470 | type = attribute.name.replace(bindingRegExp, ''); |
464 | buildBinding(node, type, attribute.value); | 471 | buildBinding('Binding', node, type, attribute.value); |
465 | } | 472 | } |
466 | } | 473 | } |
467 | } | 474 | } |
... | @@ -483,7 +490,6 @@ | ... | @@ -483,7 +490,6 @@ |
483 | 490 | ||
484 | View.prototype.select = function(fn) { | 491 | View.prototype.select = function(fn) { |
485 | var binding, _i, _len, _ref, _results; | 492 | var binding, _i, _len, _ref, _results; |
486 | |||
487 | _ref = this.bindings; | 493 | _ref = this.bindings; |
488 | _results = []; | 494 | _results = []; |
489 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { | 495 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { |
... | @@ -497,7 +503,6 @@ | ... | @@ -497,7 +503,6 @@ |
497 | 503 | ||
498 | View.prototype.bind = function() { | 504 | View.prototype.bind = function() { |
499 | var binding, _i, _len, _ref, _results; | 505 | var binding, _i, _len, _ref, _results; |
500 | |||
501 | _ref = this.bindings; | 506 | _ref = this.bindings; |
502 | _results = []; | 507 | _results = []; |
503 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { | 508 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { |
... | @@ -509,7 +514,6 @@ | ... | @@ -509,7 +514,6 @@ |
509 | 514 | ||
510 | View.prototype.unbind = function() { | 515 | View.prototype.unbind = function() { |
511 | var binding, _i, _len, _ref, _results; | 516 | var binding, _i, _len, _ref, _results; |
512 | |||
513 | _ref = this.bindings; | 517 | _ref = this.bindings; |
514 | _results = []; | 518 | _results = []; |
515 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { | 519 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { |
... | @@ -521,7 +525,6 @@ | ... | @@ -521,7 +525,6 @@ |
521 | 525 | ||
522 | View.prototype.sync = function() { | 526 | View.prototype.sync = function() { |
523 | var binding, _i, _len, _ref, _results; | 527 | var binding, _i, _len, _ref, _results; |
524 | |||
525 | _ref = this.bindings; | 528 | _ref = this.bindings; |
526 | _results = []; | 529 | _results = []; |
527 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { | 530 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { |
... | @@ -533,7 +536,6 @@ | ... | @@ -533,7 +536,6 @@ |
533 | 536 | ||
534 | View.prototype.publish = function() { | 537 | View.prototype.publish = function() { |
535 | var binding, _i, _len, _ref, _results; | 538 | var binding, _i, _len, _ref, _results; |
536 | |||
537 | _ref = this.select(function(b) { | 539 | _ref = this.select(function(b) { |
538 | return b.binder.publishes; | 540 | return b.binder.publishes; |
539 | }); | 541 | }); |
... | @@ -547,7 +549,6 @@ | ... | @@ -547,7 +549,6 @@ |
547 | 549 | ||
548 | View.prototype.update = function(models) { | 550 | View.prototype.update = function(models) { |
549 | var binding, key, model, _i, _len, _ref, _results; | 551 | var binding, key, model, _i, _len, _ref, _results; |
550 | |||
551 | if (models == null) { | 552 | if (models == null) { |
552 | models = {}; | 553 | models = {}; |
553 | } | 554 | } |
... | @@ -578,7 +579,6 @@ | ... | @@ -578,7 +579,6 @@ |
578 | 579 | ||
579 | TextTemplateParser.parse = function(template, delimiters) { | 580 | TextTemplateParser.parse = function(template, delimiters) { |
580 | var index, lastIndex, lastToken, length, substring, tokens, value; | 581 | var index, lastIndex, lastToken, length, substring, tokens, value; |
581 | |||
582 | tokens = []; | 582 | tokens = []; |
583 | length = template.length; | 583 | length = template.length; |
584 | index = 0; | 584 | index = 0; |
... | @@ -661,7 +661,6 @@ | ... | @@ -661,7 +661,6 @@ |
661 | }, | 661 | }, |
662 | getInputValue: function(el) { | 662 | getInputValue: function(el) { |
663 | var o, _i, _len, _results; | 663 | var o, _i, _len, _results; |
664 | |||
665 | if (window.jQuery != null) { | 664 | if (window.jQuery != null) { |
666 | el = jQuery(el); | 665 | el = jQuery(el); |
667 | switch (el[0].type) { | 666 | switch (el[0].type) { |
... | @@ -708,7 +707,6 @@ | ... | @@ -708,7 +707,6 @@ |
708 | }, | 707 | }, |
709 | routine: function(el, value) { | 708 | routine: function(el, value) { |
710 | var _ref; | 709 | var _ref; |
711 | |||
712 | if (el.type === 'radio') { | 710 | if (el.type === 'radio') { |
713 | return el.checked = ((_ref = el.value) != null ? _ref.toString() : void 0) === (value != null ? value.toString() : void 0); | 711 | return el.checked = ((_ref = el.value) != null ? _ref.toString() : void 0) === (value != null ? value.toString() : void 0); |
714 | } else { | 712 | } else { |
... | @@ -726,7 +724,6 @@ | ... | @@ -726,7 +724,6 @@ |
726 | }, | 724 | }, |
727 | routine: function(el, value) { | 725 | routine: function(el, value) { |
728 | var _ref; | 726 | var _ref; |
729 | |||
730 | if (el.type === 'radio') { | 727 | if (el.type === 'radio') { |
731 | return el.checked = ((_ref = el.value) != null ? _ref.toString() : void 0) !== (value != null ? value.toString() : void 0); | 728 | return el.checked = ((_ref = el.value) != null ? _ref.toString() : void 0) !== (value != null ? value.toString() : void 0); |
732 | } else { | 729 | } else { |
... | @@ -753,7 +750,6 @@ | ... | @@ -753,7 +750,6 @@ |
753 | }, | 750 | }, |
754 | routine: function(el, value) { | 751 | routine: function(el, value) { |
755 | var o, _i, _len, _ref, _ref1, _ref2, _results; | 752 | var o, _i, _len, _ref, _ref1, _ref2, _results; |
756 | |||
757 | if (window.jQuery != null) { | 753 | if (window.jQuery != null) { |
758 | el = jQuery(el); | 754 | el = jQuery(el); |
759 | if ((value != null ? value.toString() : void 0) !== ((_ref = el.val()) != null ? _ref.toString() : void 0)) { | 755 | if ((value != null ? value.toString() : void 0) !== ((_ref = el.val()) != null ? _ref.toString() : void 0)) { |
... | @@ -786,7 +782,6 @@ | ... | @@ -786,7 +782,6 @@ |
786 | block: true, | 782 | block: true, |
787 | bind: function(el) { | 783 | bind: function(el) { |
788 | var attr, declaration; | 784 | var attr, declaration; |
789 | |||
790 | if (this.marker == null) { | 785 | if (this.marker == null) { |
791 | attr = ['data', this.view.config.prefix, this.type].join('-').replace('--', '-'); | 786 | attr = ['data', this.view.config.prefix, this.type].join('-').replace('--', '-'); |
792 | declaration = el.getAttribute(attr); | 787 | declaration = el.getAttribute(attr); |
... | @@ -798,12 +793,10 @@ | ... | @@ -798,12 +793,10 @@ |
798 | }, | 793 | }, |
799 | unbind: function() { | 794 | unbind: function() { |
800 | var _ref; | 795 | var _ref; |
801 | |||
802 | return (_ref = this.nested) != null ? _ref.unbind() : void 0; | 796 | return (_ref = this.nested) != null ? _ref.unbind() : void 0; |
803 | }, | 797 | }, |
804 | routine: function(el, value) { | 798 | routine: function(el, value) { |
805 | var key, model, models, options, _ref; | 799 | var key, model, models, options, _ref; |
806 | |||
807 | if (!!value === (this.nested == null)) { | 800 | if (!!value === (this.nested == null)) { |
808 | if (value) { | 801 | if (value) { |
809 | models = {}; | 802 | models = {}; |
... | @@ -827,7 +820,8 @@ | ... | @@ -827,7 +820,8 @@ |
827 | } | 820 | } |
828 | }, | 821 | }, |
829 | update: function(models) { | 822 | update: function(models) { |
830 | return this.nested.update(models); | 823 | var _ref; |
824 | return (_ref = this.nested) != null ? _ref.update(models) : void 0; | ||
831 | } | 825 | } |
832 | }, | 826 | }, |
833 | unless: { | 827 | unless: { |
... | @@ -863,7 +857,6 @@ | ... | @@ -863,7 +857,6 @@ |
863 | block: true, | 857 | block: true, |
864 | bind: function(el) { | 858 | bind: function(el) { |
865 | var attr; | 859 | var attr; |
866 | |||
867 | if (this.marker == null) { | 860 | if (this.marker == null) { |
868 | attr = ['data', this.view.config.prefix, this.type].join('-').replace('--', '-'); | 861 | attr = ['data', this.view.config.prefix, this.type].join('-').replace('--', '-'); |
869 | this.marker = document.createComment(" rivets: " + this.type + " "); | 862 | this.marker = document.createComment(" rivets: " + this.type + " "); |
... | @@ -875,7 +868,6 @@ | ... | @@ -875,7 +868,6 @@ |
875 | }, | 868 | }, |
876 | unbind: function(el) { | 869 | unbind: function(el) { |
877 | var view, _i, _len, _ref, _results; | 870 | var view, _i, _len, _ref, _results; |
878 | |||
879 | if (this.iterated != null) { | 871 | if (this.iterated != null) { |
880 | _ref = this.iterated; | 872 | _ref = this.iterated; |
881 | _results = []; | 873 | _results = []; |
... | @@ -887,8 +879,7 @@ | ... | @@ -887,8 +879,7 @@ |
887 | } | 879 | } |
888 | }, | 880 | }, |
889 | routine: function(el, collection) { | 881 | routine: function(el, collection) { |
890 | var data, i, index, k, key, model, modelName, options, previous, template, v, view, _i, _j, _len, _len1, _ref, _ref1, _ref2, _ref3, _results; | 882 | var data, i, index, k, key, model, modelName, options, previous, template, v, view, _i, _j, _len, _len1, _ref, _ref1, _ref2, _results; |
891 | |||
892 | modelName = this.args[0]; | 883 | modelName = this.args[0]; |
893 | collection = collection || []; | 884 | collection = collection || []; |
894 | if (this.iterated.length > collection.length) { | 885 | if (this.iterated.length > collection.length) { |
... | @@ -909,7 +900,7 @@ | ... | @@ -909,7 +900,7 @@ |
909 | _ref1 = this.view.models; | 900 | _ref1 = this.view.models; |
910 | for (key in _ref1) { | 901 | for (key in _ref1) { |
911 | model = _ref1[key]; | 902 | model = _ref1[key]; |
912 | if ((_ref2 = data[key]) == null) { | 903 | if (data[key] == null) { |
913 | data[key] = model; | 904 | data[key] = model; |
914 | } | 905 | } |
915 | } | 906 | } |
... | @@ -919,9 +910,9 @@ | ... | @@ -919,9 +910,9 @@ |
919 | formatters: this.view.options.formatters, | 910 | formatters: this.view.options.formatters, |
920 | config: {} | 911 | config: {} |
921 | }; | 912 | }; |
922 | _ref3 = this.view.options.config; | 913 | _ref2 = this.view.options.config; |
923 | for (k in _ref3) { | 914 | for (k in _ref2) { |
924 | v = _ref3[k]; | 915 | v = _ref2[k]; |
925 | options.config[k] = v; | 916 | options.config[k] = v; |
926 | } | 917 | } |
927 | options.config.preloadData = true; | 918 | options.config.preloadData = true; |
... | @@ -940,7 +931,6 @@ | ... | @@ -940,7 +931,6 @@ |
940 | }, | 931 | }, |
941 | update: function(models) { | 932 | update: function(models) { |
942 | var data, key, model, view, _i, _len, _ref, _results; | 933 | var data, key, model, view, _i, _len, _ref, _results; |
943 | |||
944 | data = {}; | 934 | data = {}; |
945 | for (key in models) { | 935 | for (key in models) { |
946 | model = models[key]; | 936 | model = models[key]; |
... | @@ -959,7 +949,6 @@ | ... | @@ -959,7 +949,6 @@ |
959 | }, | 949 | }, |
960 | "class-*": function(el, value) { | 950 | "class-*": function(el, value) { |
961 | var elClass; | 951 | var elClass; |
962 | |||
963 | elClass = " " + el.className + " "; | 952 | elClass = " " + el.className + " "; |
964 | if (!value === (elClass.indexOf(" " + this.args[0] + " ") !== -1)) { | 953 | if (!value === (elClass.indexOf(" " + this.args[0] + " ") !== -1)) { |
965 | return el.className = value ? "" + el.className + " " + this.args[0] : elClass.replace(" " + this.args[0] + " ", ' ').trim(); | 954 | return el.className = value ? "" + el.className + " " + this.args[0] : elClass.replace(" " + this.args[0] + " ", ' ').trim(); |
... | @@ -974,12 +963,6 @@ | ... | @@ -974,12 +963,6 @@ |
974 | } | 963 | } |
975 | }; | 964 | }; |
976 | 965 | ||
977 | Rivets.internalBinders = { | ||
978 | textNode: function(node, value) { | ||
979 | return node.data = value != null ? value : ''; | ||
980 | } | ||
981 | }; | ||
982 | |||
983 | Rivets.components = {}; | 966 | Rivets.components = {}; |
984 | 967 | ||
985 | Rivets.config = { | 968 | Rivets.config = { |
... | @@ -999,7 +982,6 @@ | ... | @@ -999,7 +982,6 @@ |
999 | exports.config = Rivets.config; | 982 | exports.config = Rivets.config; |
1000 | exports.configure = function(options) { | 983 | exports.configure = function(options) { |
1001 | var property, value; | 984 | var property, value; |
1002 | |||
1003 | if (options == null) { | 985 | if (options == null) { |
1004 | options = {}; | 986 | options = {}; |
1005 | } | 987 | } |
... | @@ -1010,7 +992,6 @@ | ... | @@ -1010,7 +992,6 @@ |
1010 | }; | 992 | }; |
1011 | return exports.bind = function(el, models, options) { | 993 | return exports.bind = function(el, models, options) { |
1012 | var view; | 994 | var view; |
1013 | |||
1014 | if (models == null) { | 995 | if (models == null) { |
1015 | models = {}; | 996 | models = {}; |
1016 | } | 997 | } | ... | ... |
1 | // Rivets.js | 1 | // Rivets.js |
2 | // version: 0.5.11 | 2 | // version: 0.5.12 |
3 | // author: Michael Richards | 3 | // author: Michael Richards |
4 | // license: MIT | 4 | // license: MIT |
5 | (function(){var t,i=function(t,i){return function(){return t.apply(i,arguments)}},e=[].slice,n={}.hasOwnProperty,s=function(t,i){function e(){this.constructor=t}for(var s in i)n.call(i,s)&&(t[s]=i[s]);return e.prototype=i.prototype,t.prototype=new e,t.__super__=i.prototype,t},r=[].indexOf||function(t){for(var i=0,e=this.length;e>i;i++)if(i in this&&this[i]===t)return i;return-1};t={},String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),t.Binding=function(){function n(e,n,s,r,o,h){var l,u,a,d;if(this.view=e,this.el=n,this.type=s,this.key=r,this.keypath=o,this.options=null!=h?h:{},this.update=i(this.update,this),this.unbind=i(this.unbind,this),this.bind=i(this.bind,this),this.publish=i(this.publish,this),this.sync=i(this.sync,this),this.set=i(this.set,this),this.eventHandler=i(this.eventHandler,this),this.formattedValue=i(this.formattedValue,this),!(this.binder=t.internalBinders[this.type]||this.view.binders[s])){d=this.view.binders;for(l in d)a=d[l],"*"!==l&&-1!==l.indexOf("*")&&(u=RegExp("^"+l.replace("*",".+")+"$"),u.test(s)&&(this.binder=a,this.args=RegExp("^"+l.replace("*","(.+)")+"$").exec(s),this.args.shift()))}this.binder||(this.binder=this.view.binders["*"]),this.binder instanceof Function&&(this.binder={routine:this.binder}),this.formatters=this.options.formatters||[],this.model=this.key?this.view.models[this.key]:this.view.models}return n.prototype.formattedValue=function(t){var i,n,s,r,o,h;for(h=this.formatters,r=0,o=h.length;o>r;r++)n=h[r],i=n.split(/\s+/),s=i.shift(),n=this.model[s]instanceof Function?this.model[s]:this.view.formatters[s],(null!=n?n.read:void 0)instanceof Function?t=n.read.apply(n,[t].concat(e.call(i))):n instanceof Function&&(t=n.apply(null,[t].concat(e.call(i))));return t},n.prototype.eventHandler=function(t){var i,e;return e=(i=this).view.config.handler,function(n){return e.call(t,this,n,i)}},n.prototype.set=function(t){var i;return t=t instanceof Function&&!this.binder["function"]?this.formattedValue(t.call(this.model)):this.formattedValue(t),null!=(i=this.binder.routine)?i.call(this,this.el,t):void 0},n.prototype.sync=function(){return this.set(this.options.bypass?this.model[this.keypath]:this.view.config.adapter.read(this.model,this.keypath))},n.prototype.publish=function(){var i,n,s,r,o,h,l,u,a;for(r=t.Util.getInputValue(this.el),l=this.formatters.slice(0).reverse(),o=0,h=l.length;h>o;o++)n=l[o],i=n.split(/\s+/),s=i.shift(),(null!=(u=this.view.formatters[s])?u.publish:void 0)&&(r=(a=this.view.formatters[s]).publish.apply(a,[r].concat(e.call(i))));return this.view.config.adapter.publish(this.model,this.keypath,r)},n.prototype.bind=function(){var t,i,e,n,s,r,o,h,l;if(null!=(r=this.binder.bind)&&r.call(this,this.el),this.options.bypass?this.sync():(this.view.config.adapter.subscribe(this.model,this.keypath,this.sync),this.view.config.preloadData&&this.sync()),null!=(o=this.options.dependencies)?o.length:void 0){for(h=this.options.dependencies,l=[],n=0,s=h.length;s>n;n++)t=h[n],/^\./.test(t)?(e=this.model,i=t.substr(1)):(t=t.split("."),e=this.view.models[t.shift()],i=t.join(".")),l.push(this.view.config.adapter.subscribe(e,i,this.sync));return l}},n.prototype.unbind=function(){var t,i,e,n,s,r,o,h,l;if(null!=(r=this.binder.unbind)&&r.call(this,this.el),this.options.bypass||this.view.config.adapter.unsubscribe(this.model,this.keypath,this.sync),null!=(o=this.options.dependencies)?o.length:void 0){for(h=this.options.dependencies,l=[],n=0,s=h.length;s>n;n++)t=h[n],/^\./.test(t)?(e=this.model,i=t.substr(1)):(t=t.split("."),e=this.view.models[t.shift()],i=t.join(".")),l.push(this.view.config.adapter.unsubscribe(e,i,this.sync));return l}},n.prototype.update=function(t){var i;return null==t&&(t={}),this.key?t[this.key]&&(this.options.bypass||this.view.config.adapter.unsubscribe(this.model,this.keypath,this.sync),this.model=t[this.key],this.options.bypass?this.sync():(this.view.config.adapter.subscribe(this.model,this.keypath,this.sync),this.view.config.preloadData&&this.sync())):this.sync(),null!=(i=this.binder.update)?i.call(this,t):void 0},n}(),t.ComponentBinding=function(e){function n(e,n,s){var o,h,l,u,a;for(this.view=e,this.el=n,this.type=s,this.unbind=i(this.unbind,this),this.bind=i(this.bind,this),this.update=i(this.update,this),this.locals=i(this.locals,this),this.component=t.components[this.type],this.attributes={},this.inflections={},u=this.el.attributes||[],h=0,l=u.length;l>h;h++)o=u[h],a=o.name,r.call(this.component.attributes,a)>=0?this.attributes[o.name]=o.value:this.inflections[o.name]=o.value}return s(n,e),n.prototype.sync=function(){},n.prototype.locals=function(t){var i,e,n,s,r,o,h,l,u,a;null==t&&(t=this.view.models),r={},l=this.inflections;for(e in l)for(i=l[e],u=i.split("."),o=0,h=u.length;h>o;o++)s=u[o],r[e]=(r[e]||t)[s];for(e in t)n=t[e],null==(a=r[e])&&(r[e]=n);return r},n.prototype.update=function(t){var i;return null!=(i=this.componentView)?i.update(this.locals(t)):void 0},n.prototype.bind=function(){var i,e;return null!=this.componentView?null!=(e=this.componentView)?e.bind():void 0:(i=this.component.build.call(this.attributes),(this.componentView=new t.View(i,this.locals(),this.view.options)).bind(),this.el.parentNode.replaceChild(i,this.el))},n.prototype.unbind=function(){var t;return null!=(t=this.componentView)?t.unbind():void 0},n}(t.Binding),t.View=function(){function n(e,n,s){var r,o,h,l,u,a,d,p,c,f;for(this.els=e,this.models=n,this.options=null!=s?s:{},this.update=i(this.update,this),this.publish=i(this.publish,this),this.sync=i(this.sync,this),this.unbind=i(this.unbind,this),this.bind=i(this.bind,this),this.select=i(this.select,this),this.build=i(this.build,this),this.componentRegExp=i(this.componentRegExp,this),this.bindingRegExp=i(this.bindingRegExp,this),this.els.jquery||this.els instanceof Array||(this.els=[this.els]),d=["config","binders","formatters"],u=0,a=d.length;a>u;u++){if(o=d[u],this[o]={},this.options[o]){p=this.options[o];for(r in p)h=p[r],this[o][r]=h}c=t[o];for(r in c)h=c[r],null==(f=(l=this[o])[r])&&(l[r]=h)}this.build()}return n.prototype.bindingRegExp=function(){var t;return t=this.config.prefix,t?RegExp("^data-"+t+"-"):/^data-/},n.prototype.componentRegExp=function(){var t,i;return RegExp("^"+(null!=(t=null!=(i=this.config.prefix)?i.toUpperCase():void 0)?t:"RV")+"-")},n.prototype.build=function(){var i,n,s,o,h,l,u,a,d,p=this;for(this.bindings=[],l=[],i=this.bindingRegExp(),s=this.componentRegExp(),n=function(i,e,n){var s,r,o,h,l,u,a,d,c,f;return u={},c=function(){var t,i,e,s;for(e=n.split("|"),s=[],t=0,i=e.length;i>t;t++)d=e[t],s.push(d.trim());return s}(),s=function(){var t,i,e,n;for(e=c.shift().split("<"),n=[],t=0,i=e.length;i>t;t++)r=e[t],n.push(r.trim());return n}(),a=s.shift(),f=a.split(/\.|:/),u.formatters=c,u.bypass=-1!==a.indexOf(":"),f[0]?h=f.shift():(h=null,f.shift()),l=f.join("."),(o=s.shift())&&(u.dependencies=o.split(/\s+/)),p.bindings.push(new t.Binding(p,i,e,h,l,u))},h=function(o){var u,a,d,c,f,b,v,g,y,m,w,x,k,E,N,V,j,R,C,U,B,T,O,Q,A,D,L,_,F,H,S,$;if(0>r.call(l,o)){if(o.nodeType===Node.TEXT_NODE){if(g=t.TextTemplateParser,(f=p.config.templateDelimiters)&&(E=g.parse(o.data,f)).length&&(1!==E.length||E[0].type!==g.types.text)){switch(w=E[0],m=E.length>=2?e.call(E,1):[],o.data=w.value,w.type){case 0:o.data=w.value;break;case 1:n(o,"textNode",w.value)}for(j=0,B=m.length;B>j;j++)k=m[j],o.parentNode.appendChild(x=document.createTextNode(k.value)),1===k.type&&n(x,"textNode",k.value)}}else if(s.test(o.tagName))N=o.tagName.replace(s,"").toLowerCase(),p.bindings.push(new t.ComponentBinding(p,o,N));else if(null!=o.attributes){for(L=o.attributes,R=0,T=L.length;T>R;R++)if(u=L[R],i.test(u.name)){if(N=u.name.replace(i,""),!(d=p.binders[N])){_=p.binders;for(b in _)V=_[b],"*"!==b&&-1!==b.indexOf("*")&&(y=RegExp("^"+b.replace("*",".+")+"$"),y.test(N)&&(d=V))}if(d||(d=p.binders["*"]),d.block){for(F=o.childNodes,C=0,O=F.length;O>C;C++)v=F[C],l.push(v);a=[u]}}for(H=a||o.attributes,U=0,Q=H.length;Q>U;U++)u=H[U],i.test(u.name)&&(N=u.name.replace(i,""),n(o,N,u.value))}for(S=o.childNodes,$=[],D=0,A=S.length;A>D;D++)c=S[D],$.push(h(c));return $}},d=this.els,u=0,a=d.length;a>u;u++)o=d[u],h(o)},n.prototype.select=function(t){var i,e,n,s,r;for(s=this.bindings,r=[],e=0,n=s.length;n>e;e++)i=s[e],t(i)&&r.push(i);return r},n.prototype.bind=function(){var t,i,e,n,s;for(n=this.bindings,s=[],i=0,e=n.length;e>i;i++)t=n[i],s.push(t.bind());return s},n.prototype.unbind=function(){var t,i,e,n,s;for(n=this.bindings,s=[],i=0,e=n.length;e>i;i++)t=n[i],s.push(t.unbind());return s},n.prototype.sync=function(){var t,i,e,n,s;for(n=this.bindings,s=[],i=0,e=n.length;e>i;i++)t=n[i],s.push(t.sync());return s},n.prototype.publish=function(){var t,i,e,n,s;for(n=this.select(function(t){return t.binder.publishes}),s=[],i=0,e=n.length;e>i;i++)t=n[i],s.push(t.publish());return s},n.prototype.update=function(t){var i,e,n,s,r,o,h;null==t&&(t={});for(e in t)n=t[e],this.models[e]=n;for(o=this.bindings,h=[],s=0,r=o.length;r>s;s++)i=o[s],h.push(i.update(t));return h},n}(),t.TextTemplateParser=function(){function t(){}return t.types={text:0,binding:1},t.parse=function(t,i){var e,n,s,r,o,h,l;for(h=[],r=t.length,e=0,n=0;r>n;){if(e=t.indexOf(i[0],n),0>e){h.push({type:this.types.text,value:t.slice(n)});break}if(e>0&&e>n&&h.push({type:this.types.text,value:t.slice(n,e)}),n=e+2,e=t.indexOf(i[1],n),0>e){o=t.slice(n-2),s=h[h.length-1],(null!=s?s.type:void 0)===this.types.text?s.value+=o:h.push({type:this.types.text,value:o});break}l=t.slice(n,e).trim(),h.push({type:this.types.binding,value:l}),n=e+2}return h},t}(),t.Util={bindEvent:function(t,i,e){return null!=window.jQuery?(t=jQuery(t),null!=t.on?t.on(i,e):t.bind(i,e)):null!=window.addEventListener?t.addEventListener(i,e,!1):(i="on"+i,t.attachEvent(i,e))},unbindEvent:function(t,i,e){return null!=window.jQuery?(t=jQuery(t),null!=t.off?t.off(i,e):t.unbind(i,e)):null!=window.removeEventListener?t.removeEventListener(i,e,!1):(i="on"+i,t.detachEvent(i,e))},getInputValue:function(t){var i,e,n,s;if(null!=window.jQuery)switch(t=jQuery(t),t[0].type){case"checkbox":return t.is(":checked");default:return t.val()}else switch(t.type){case"checkbox":return t.checked;case"select-multiple":for(s=[],e=0,n=t.length;n>e;e++)i=t[e],i.selected&&s.push(i.value);return s;default:return t.value}}},t.binders={enabled:function(t,i){return t.disabled=!i},disabled:function(t,i){return t.disabled=!!i},checked:{publishes:!0,bind:function(i){return t.Util.bindEvent(i,"change",this.publish)},unbind:function(i){return t.Util.unbindEvent(i,"change",this.publish)},routine:function(t,i){var e;return t.checked="radio"===t.type?(null!=(e=t.value)?""+e:void 0)===(null!=i?""+i:void 0):!!i}},unchecked:{publishes:!0,bind:function(i){return t.Util.bindEvent(i,"change",this.publish)},unbind:function(i){return t.Util.unbindEvent(i,"change",this.publish)},routine:function(t,i){var e;return t.checked="radio"===t.type?(null!=(e=t.value)?""+e:void 0)!==(null!=i?""+i:void 0):!i}},show:function(t,i){return t.style.display=i?"":"none"},hide:function(t,i){return t.style.display=i?"none":""},html:function(t,i){return t.innerHTML=null!=i?i:""},value:{publishes:!0,bind:function(i){return t.Util.bindEvent(i,"change",this.publish)},unbind:function(i){return t.Util.unbindEvent(i,"change",this.publish)},routine:function(t,i){var e,n,s,o,h,l,u;if(null!=window.jQuery){if(t=jQuery(t),(null!=i?""+i:void 0)!==(null!=(o=t.val())?""+o:void 0))return t.val(null!=i?i:"")}else if("select-multiple"===t.type){if(null!=i){for(u=[],n=0,s=t.length;s>n;n++)e=t[n],u.push(e.selected=(h=e.value,r.call(i,h)>=0));return u}}else if((null!=i?""+i:void 0)!==(null!=(l=t.value)?""+l:void 0))return t.value=null!=i?i:""}},text:function(t,i){return null!=t.innerText?t.innerText=null!=i?i:"":t.textContent=null!=i?i:""},"if":{block:!0,bind:function(t){var i,e;return null==this.marker?(i=["data",this.view.config.prefix,this.type].join("-").replace("--","-"),e=t.getAttribute(i),this.marker=document.createComment(" rivets: "+this.type+" "+e+" "),t.removeAttribute(i),t.parentNode.insertBefore(this.marker,t),t.parentNode.removeChild(t)):void 0},unbind:function(){var t;return null!=(t=this.nested)?t.unbind():void 0},routine:function(i,e){var n,s,r,o,h;if(!!e==(null==this.nested)){if(e){r={},h=this.view.models;for(n in h)s=h[n],r[n]=s;return o={binders:this.view.options.binders,formatters:this.view.options.formatters,config:this.view.options.config},(this.nested=new t.View(i,r,o)).bind(),this.marker.parentNode.insertBefore(i,this.marker.nextSibling)}return i.parentNode.removeChild(i),this.nested.unbind(),delete this.nested}},update:function(t){return this.nested.update(t)}},unless:{block:!0,bind:function(i){return t.binders["if"].bind.call(this,i)},unbind:function(){return t.binders["if"].unbind.call(this)},routine:function(i,e){return t.binders["if"].routine.call(this,i,!e)},update:function(i){return t.binders["if"].update.call(this,i)}},"on-*":{"function":!0,unbind:function(i){return this.handler?t.Util.unbindEvent(i,this.args[0],this.handler):void 0},routine:function(i,e){return this.handler&&t.Util.unbindEvent(i,this.args[0],this.handler),t.Util.bindEvent(i,this.args[0],this.handler=this.eventHandler(e))}},"each-*":{block:!0,bind:function(t){var i;return null==this.marker?(i=["data",this.view.config.prefix,this.type].join("-").replace("--","-"),this.marker=document.createComment(" rivets: "+this.type+" "),this.iterated=[],t.removeAttribute(i),t.parentNode.insertBefore(this.marker,t),t.parentNode.removeChild(t)):void 0},unbind:function(){var t,i,e,n,s;if(null!=this.iterated){for(n=this.iterated,s=[],i=0,e=n.length;e>i;i++)t=n[i],s.push(t.unbind());return s}},routine:function(i,e){var n,s,r,o,h,l,u,a,d,p,c,f,b,v,g,y,m,w,x,k,E;if(u=this.args[0],e=e||[],this.iterated.length>e.length)for(m=Array(this.iterated.length-e.length),b=0,g=m.length;g>b;b++)s=m[b],f=this.iterated.pop(),f.unbind(),this.marker.parentNode.removeChild(f.els[0]);for(E=[],r=v=0,y=e.length;y>v;r=++v)if(l=e[r],n={},n[u]=l,null==this.iterated[r]){w=this.view.models;for(h in w)l=w[h],null==(x=n[h])&&(n[h]=l);d=this.iterated.length?this.iterated[this.iterated.length-1].els[0]:this.marker,a={binders:this.view.options.binders,formatters:this.view.options.formatters,config:{}},k=this.view.options.config;for(o in k)c=k[o],a.config[o]=c;a.config.preloadData=!0,p=i.cloneNode(!0),f=new t.View(p,n,a),f.bind(),this.iterated.push(f),E.push(this.marker.parentNode.insertBefore(p,d.nextSibling))}else this.iterated[r].models[u]!==l?E.push(this.iterated[r].update(n)):E.push(void 0);return E},update:function(t){var i,e,n,s,r,o,h,l;i={};for(e in t)n=t[e],e!==this.args[0]&&(i[e]=n);for(h=this.iterated,l=[],r=0,o=h.length;o>r;r++)s=h[r],l.push(s.update(i));return l}},"class-*":function(t,i){var e;return e=" "+t.className+" ",!i==(-1!==e.indexOf(" "+this.args[0]+" "))?t.className=i?""+t.className+" "+this.args[0]:e.replace(" "+this.args[0]+" "," ").trim():void 0},"*":function(t,i){return i?t.setAttribute(this.type,i):t.removeAttribute(this.type)}},t.internalBinders={textNode:function(t,i){return t.data=null!=i?i:""}},t.components={},t.config={preloadData:!0,handler:function(t,i,e){return this.call(t,i,e.view.models)}},t.formatters={},t.factory=function(i){return i._=t,i.binders=t.binders,i.components=t.components,i.formatters=t.formatters,i.config=t.config,i.configure=function(i){var e,n;null==i&&(i={});for(e in i)n=i[e],t.config[e]=n},i.bind=function(i,e,n){var s;return null==e&&(e={}),null==n&&(n={}),s=new t.View(i,e,n),s.bind(),s}},"object"==typeof exports?t.factory(exports):"function"==typeof define&&define.amd?define(["exports"],function(i){return t.factory(this.rivets=i),i}):t.factory(this.rivets={})}).call(this); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
5 | !function(){var a,b=function(a,b){return function(){return a.apply(b,arguments)}},c=[].slice,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},f=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1};a={},String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),a.Binding=function(){function d(a,c,d,e,f,g){var h,i,j,k;if(this.view=a,this.el=c,this.type=d,this.key=e,this.keypath=f,this.options=null!=g?g:{},this.update=b(this.update,this),this.unbind=b(this.unbind,this),this.bind=b(this.bind,this),this.publish=b(this.publish,this),this.sync=b(this.sync,this),this.set=b(this.set,this),this.eventHandler=b(this.eventHandler,this),this.formattedValue=b(this.formattedValue,this),!(this.binder=this.view.binders[d])){k=this.view.binders;for(h in k)j=k[h],"*"!==h&&-1!==h.indexOf("*")&&(i=new RegExp("^"+h.replace("*",".+")+"$"),i.test(d)&&(this.binder=j,this.args=new RegExp("^"+h.replace("*","(.+)")+"$").exec(d),this.args.shift()))}this.binder||(this.binder=this.view.binders["*"]),this.binder instanceof Function&&(this.binder={routine:this.binder}),this.formatters=this.options.formatters||[],this.model=this.key?this.view.models[this.key]:this.view.models}return d.prototype.formattedValue=function(a){var b,d,e,f,g,h;for(h=this.formatters,f=0,g=h.length;g>f;f++)d=h[f],b=d.split(/\s+/),e=b.shift(),d=this.model[e]instanceof Function?this.model[e]:this.view.formatters[e],(null!=d?d.read:void 0)instanceof Function?a=d.read.apply(d,[a].concat(c.call(b))):d instanceof Function&&(a=d.apply(null,[a].concat(c.call(b))));return a},d.prototype.eventHandler=function(a){var b,c;return c=(b=this).view.config.handler,function(d){return c.call(a,this,d,b)}},d.prototype.set=function(a){var b;return a=a instanceof Function&&!this.binder["function"]?this.formattedValue(a.call(this.model)):this.formattedValue(a),null!=(b=this.binder.routine)?b.call(this,this.el,a):void 0},d.prototype.sync=function(){return this.set(this.options.bypass?this.model[this.keypath]:this.view.config.adapter.read(this.model,this.keypath))},d.prototype.publish=function(){var b,d,e,f,g,h,i,j,k;for(f=a.Util.getInputValue(this.el),i=this.formatters.slice(0).reverse(),g=0,h=i.length;h>g;g++)d=i[g],b=d.split(/\s+/),e=b.shift(),(null!=(j=this.view.formatters[e])?j.publish:void 0)&&(f=(k=this.view.formatters[e]).publish.apply(k,[f].concat(c.call(b))));return this.view.config.adapter.publish(this.model,this.keypath,f)},d.prototype.bind=function(){var a,b,c,d,e,f,g,h,i;if(null!=(f=this.binder.bind)&&f.call(this,this.el),this.options.bypass?this.sync():(this.view.config.adapter.subscribe(this.model,this.keypath,this.sync),this.view.config.preloadData&&this.sync()),null!=(g=this.options.dependencies)?g.length:void 0){for(h=this.options.dependencies,i=[],d=0,e=h.length;e>d;d++)a=h[d],/^\./.test(a)?(c=this.model,b=a.substr(1)):(a=a.split("."),c=this.view.models[a.shift()],b=a.join(".")),i.push(this.view.config.adapter.subscribe(c,b,this.sync));return i}},d.prototype.unbind=function(){var a,b,c,d,e,f,g,h,i;if(null!=(f=this.binder.unbind)&&f.call(this,this.el),this.options.bypass||this.view.config.adapter.unsubscribe(this.model,this.keypath,this.sync),null!=(g=this.options.dependencies)?g.length:void 0){for(h=this.options.dependencies,i=[],d=0,e=h.length;e>d;d++)a=h[d],/^\./.test(a)?(c=this.model,b=a.substr(1)):(a=a.split("."),c=this.view.models[a.shift()],b=a.join(".")),i.push(this.view.config.adapter.unsubscribe(c,b,this.sync));return i}},d.prototype.update=function(a){var b;return null==a&&(a={}),this.key?a[this.key]&&(this.options.bypass||this.view.config.adapter.unsubscribe(this.model,this.keypath,this.sync),this.model=a[this.key],this.options.bypass?this.sync():(this.view.config.adapter.subscribe(this.model,this.keypath,this.sync),this.view.config.preloadData&&this.sync())):this.sync(),null!=(b=this.binder.update)?b.call(this,a):void 0},d}(),a.ComponentBinding=function(c){function d(c,d,e){var g,h,i,j,k;for(this.view=c,this.el=d,this.type=e,this.unbind=b(this.unbind,this),this.bind=b(this.bind,this),this.update=b(this.update,this),this.locals=b(this.locals,this),this.component=a.components[this.type],this.attributes={},this.inflections={},j=this.el.attributes||[],h=0,i=j.length;i>h;h++)g=j[h],k=g.name,f.call(this.component.attributes,k)>=0?this.attributes[g.name]=g.value:this.inflections[g.name]=g.value}return e(d,c),d.prototype.sync=function(){},d.prototype.locals=function(a){var b,c,d,e,f,g,h,i,j;null==a&&(a=this.view.models),f={},i=this.inflections;for(c in i)for(b=i[c],j=b.split("."),g=0,h=j.length;h>g;g++)e=j[g],f[c]=(f[c]||a)[e];for(c in a)d=a[c],null==f[c]&&(f[c]=d);return f},d.prototype.update=function(a){var b;return null!=(b=this.componentView)?b.update(this.locals(a)):void 0},d.prototype.bind=function(){var b,c;return null!=this.componentView?null!=(c=this.componentView)?c.bind():void 0:(b=this.component.build.call(this.attributes),(this.componentView=new a.View(b,this.locals(),this.view.options)).bind(),this.el.parentNode.replaceChild(b,this.el))},d.prototype.unbind=function(){var a;return null!=(a=this.componentView)?a.unbind():void 0},d}(a.Binding),a.TextBinding=function(a){function c(a,c,d,e,f,g){this.view=a,this.el=c,this.type=d,this.key=e,this.keypath=f,this.options=null!=g?g:{},this.sync=b(this.sync,this),this.formatters=this.options.formatters||[],this.model=this.key?this.view.models[this.key]:this.view.models}return e(c,a),c.prototype.binder={routine:function(a,b){return a.data=null!=b?b:""}},c.prototype.sync=function(){return c.__super__.sync.apply(this,arguments)},c}(a.Binding),a.View=function(){function d(c,d,e){var f,g,h,i,j,k,l,m,n;for(this.els=c,this.models=d,this.options=null!=e?e:{},this.update=b(this.update,this),this.publish=b(this.publish,this),this.sync=b(this.sync,this),this.unbind=b(this.unbind,this),this.bind=b(this.bind,this),this.select=b(this.select,this),this.build=b(this.build,this),this.componentRegExp=b(this.componentRegExp,this),this.bindingRegExp=b(this.bindingRegExp,this),this.els.jquery||this.els instanceof Array||(this.els=[this.els]),l=["config","binders","formatters"],j=0,k=l.length;k>j;j++){if(g=l[j],this[g]={},this.options[g]){m=this.options[g];for(f in m)h=m[f],this[g][f]=h}n=a[g];for(f in n)h=n[f],null==(i=this[g])[f]&&(i[f]=h)}this.build()}return d.prototype.bindingRegExp=function(){var a;return a=this.config.prefix,a?new RegExp("^data-"+a+"-"):/^data-/},d.prototype.componentRegExp=function(){var a,b;return new RegExp("^"+(null!=(a=null!=(b=this.config.prefix)?b.toUpperCase():void 0)?a:"RV")+"-")},d.prototype.build=function(){var b,d,e,g,h,i,j,k,l,m=this;for(this.bindings=[],i=[],b=this.bindingRegExp(),e=this.componentRegExp(),d=function(b,c,d,e){var f,g,h,i,j,k,l,n,o,p;return k={},o=function(){var a,b,c,d;for(c=e.split("|"),d=[],a=0,b=c.length;b>a;a++)n=c[a],d.push(n.trim());return d}(),f=function(){var a,b,c,d;for(c=o.shift().split("<"),d=[],a=0,b=c.length;b>a;a++)g=c[a],d.push(g.trim());return d}(),l=f.shift(),p=l.split(/\.|:/),k.formatters=o,k.bypass=-1!==l.indexOf(":"),p[0]?i=p.shift():(i=null,p.shift()),j=p.join("."),(h=f.shift())&&(k.dependencies=h.split(/\s+/)),m.bindings.push(new a[b](m,c,d,i,j,k))},h=function(g){var j,k,l,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P;if(f.call(i,g)<0){if(g.nodeType===Node.TEXT_NODE){if(r=a.TextTemplateParser,(o=m.config.templateDelimiters)&&(x=r.parse(g.data,o)).length&&(1!==x.length||x[0].type!==r.types.text))for(u=x[0],t=2<=x.length?c.call(x,1):[],g.data=u.value,0===u.type?g.data=u.value:d("TextBinding",g,null,u.value),A=0,E=t.length;E>A;A++)w=t[A],v=document.createTextNode(w.value),g.parentNode.appendChild(v),1===w.type&&d("TextBinding",v,null,w.value)}else if(e.test(g.tagName))y=g.tagName.replace(e,"").toLowerCase(),m.bindings.push(new a.ComponentBinding(m,g,y));else if(null!=g.attributes){for(K=g.attributes,B=0,F=K.length;F>B;B++)if(j=K[B],b.test(j.name)){if(y=j.name.replace(b,""),!(l=m.binders[y])){L=m.binders;for(p in L)z=L[p],"*"!==p&&-1!==p.indexOf("*")&&(s=new RegExp("^"+p.replace("*",".+")+"$"),s.test(y)&&(l=z))}if(l||(l=m.binders["*"]),l.block){for(M=g.childNodes,C=0,G=M.length;G>C;C++)q=M[C],i.push(q);k=[j]}}for(N=k||g.attributes,D=0,H=N.length;H>D;D++)j=N[D],b.test(j.name)&&(y=j.name.replace(b,""),d("Binding",g,y,j.value))}for(O=g.childNodes,P=[],J=0,I=O.length;I>J;J++)n=O[J],P.push(h(n));return P}},l=this.els,j=0,k=l.length;k>j;j++)g=l[j],h(g)},d.prototype.select=function(a){var b,c,d,e,f;for(e=this.bindings,f=[],c=0,d=e.length;d>c;c++)b=e[c],a(b)&&f.push(b);return f},d.prototype.bind=function(){var a,b,c,d,e;for(d=this.bindings,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(a.bind());return e},d.prototype.unbind=function(){var a,b,c,d,e;for(d=this.bindings,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(a.unbind());return e},d.prototype.sync=function(){var a,b,c,d,e;for(d=this.bindings,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(a.sync());return e},d.prototype.publish=function(){var a,b,c,d,e;for(d=this.select(function(a){return a.binder.publishes}),e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(a.publish());return e},d.prototype.update=function(a){var b,c,d,e,f,g,h;null==a&&(a={});for(c in a)d=a[c],this.models[c]=d;for(g=this.bindings,h=[],e=0,f=g.length;f>e;e++)b=g[e],h.push(b.update(a));return h},d}(),a.TextTemplateParser=function(){function a(){}return a.types={text:0,binding:1},a.parse=function(a,b){var c,d,e,f,g,h,i;for(h=[],f=a.length,c=0,d=0;f>d;){if(c=a.indexOf(b[0],d),0>c){h.push({type:this.types.text,value:a.slice(d)});break}if(c>0&&c>d&&h.push({type:this.types.text,value:a.slice(d,c)}),d=c+2,c=a.indexOf(b[1],d),0>c){g=a.slice(d-2),e=h[h.length-1],(null!=e?e.type:void 0)===this.types.text?e.value+=g:h.push({type:this.types.text,value:g});break}i=a.slice(d,c).trim(),h.push({type:this.types.binding,value:i}),d=c+2}return h},a}(),a.Util={bindEvent:function(a,b,c){return null!=window.jQuery?(a=jQuery(a),null!=a.on?a.on(b,c):a.bind(b,c)):null!=window.addEventListener?a.addEventListener(b,c,!1):(b="on"+b,a.attachEvent(b,c))},unbindEvent:function(a,b,c){return null!=window.jQuery?(a=jQuery(a),null!=a.off?a.off(b,c):a.unbind(b,c)):null!=window.removeEventListener?a.removeEventListener(b,c,!1):(b="on"+b,a.detachEvent(b,c))},getInputValue:function(a){var b,c,d,e;if(null!=window.jQuery)switch(a=jQuery(a),a[0].type){case"checkbox":return a.is(":checked");default:return a.val()}else switch(a.type){case"checkbox":return a.checked;case"select-multiple":for(e=[],c=0,d=a.length;d>c;c++)b=a[c],b.selected&&e.push(b.value);return e;default:return a.value}}},a.binders={enabled:function(a,b){return a.disabled=!b},disabled:function(a,b){return a.disabled=!!b},checked:{publishes:!0,bind:function(b){return a.Util.bindEvent(b,"change",this.publish)},unbind:function(b){return a.Util.unbindEvent(b,"change",this.publish)},routine:function(a,b){var c;return a.checked="radio"===a.type?(null!=(c=a.value)?c.toString():void 0)===(null!=b?b.toString():void 0):!!b}},unchecked:{publishes:!0,bind:function(b){return a.Util.bindEvent(b,"change",this.publish)},unbind:function(b){return a.Util.unbindEvent(b,"change",this.publish)},routine:function(a,b){var c;return a.checked="radio"===a.type?(null!=(c=a.value)?c.toString():void 0)!==(null!=b?b.toString():void 0):!b}},show:function(a,b){return a.style.display=b?"":"none"},hide:function(a,b){return a.style.display=b?"none":""},html:function(a,b){return a.innerHTML=null!=b?b:""},value:{publishes:!0,bind:function(b){return a.Util.bindEvent(b,"change",this.publish)},unbind:function(b){return a.Util.unbindEvent(b,"change",this.publish)},routine:function(a,b){var c,d,e,g,h,i,j;if(null!=window.jQuery){if(a=jQuery(a),(null!=b?b.toString():void 0)!==(null!=(g=a.val())?g.toString():void 0))return a.val(null!=b?b:"")}else if("select-multiple"===a.type){if(null!=b){for(j=[],d=0,e=a.length;e>d;d++)c=a[d],j.push(c.selected=(h=c.value,f.call(b,h)>=0));return j}}else if((null!=b?b.toString():void 0)!==(null!=(i=a.value)?i.toString():void 0))return a.value=null!=b?b:""}},text:function(a,b){return null!=a.innerText?a.innerText=null!=b?b:"":a.textContent=null!=b?b:""},"if":{block:!0,bind:function(a){var b,c;return null==this.marker?(b=["data",this.view.config.prefix,this.type].join("-").replace("--","-"),c=a.getAttribute(b),this.marker=document.createComment(" rivets: "+this.type+" "+c+" "),a.removeAttribute(b),a.parentNode.insertBefore(this.marker,a),a.parentNode.removeChild(a)):void 0},unbind:function(){var a;return null!=(a=this.nested)?a.unbind():void 0},routine:function(b,c){var d,e,f,g,h;if(!!c==(null==this.nested)){if(c){f={},h=this.view.models;for(d in h)e=h[d],f[d]=e;return g={binders:this.view.options.binders,formatters:this.view.options.formatters,config:this.view.options.config},(this.nested=new a.View(b,f,g)).bind(),this.marker.parentNode.insertBefore(b,this.marker.nextSibling)}return b.parentNode.removeChild(b),this.nested.unbind(),delete this.nested}},update:function(a){var b;return null!=(b=this.nested)?b.update(a):void 0}},unless:{block:!0,bind:function(b){return a.binders["if"].bind.call(this,b)},unbind:function(){return a.binders["if"].unbind.call(this)},routine:function(b,c){return a.binders["if"].routine.call(this,b,!c)},update:function(b){return a.binders["if"].update.call(this,b)}},"on-*":{"function":!0,unbind:function(b){return this.handler?a.Util.unbindEvent(b,this.args[0],this.handler):void 0},routine:function(b,c){return this.handler&&a.Util.unbindEvent(b,this.args[0],this.handler),a.Util.bindEvent(b,this.args[0],this.handler=this.eventHandler(c))}},"each-*":{block:!0,bind:function(a){var b;return null==this.marker?(b=["data",this.view.config.prefix,this.type].join("-").replace("--","-"),this.marker=document.createComment(" rivets: "+this.type+" "),this.iterated=[],a.removeAttribute(b),a.parentNode.insertBefore(this.marker,a),a.parentNode.removeChild(a)):void 0},unbind:function(){var a,b,c,d,e;if(null!=this.iterated){for(d=this.iterated,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(a.unbind());return e}},routine:function(b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w;if(j=this.args[0],c=c||[],this.iterated.length>c.length)for(t=Array(this.iterated.length-c.length),p=0,r=t.length;r>p;p++)e=t[p],o=this.iterated.pop(),o.unbind(),this.marker.parentNode.removeChild(o.els[0]);for(w=[],f=q=0,s=c.length;s>q;f=++q)if(i=c[f],d={},d[j]=i,null==this.iterated[f]){u=this.view.models;for(h in u)i=u[h],null==d[h]&&(d[h]=i);l=this.iterated.length?this.iterated[this.iterated.length-1].els[0]:this.marker,k={binders:this.view.options.binders,formatters:this.view.options.formatters,config:{}},v=this.view.options.config;for(g in v)n=v[g],k.config[g]=n;k.config.preloadData=!0,m=b.cloneNode(!0),o=new a.View(m,d,k),o.bind(),this.iterated.push(o),w.push(this.marker.parentNode.insertBefore(m,l.nextSibling))}else this.iterated[f].models[j]!==i?w.push(this.iterated[f].update(d)):w.push(void 0);return w},update:function(a){var b,c,d,e,f,g,h,i;b={};for(c in a)d=a[c],c!==this.args[0]&&(b[c]=d);for(h=this.iterated,i=[],f=0,g=h.length;g>f;f++)e=h[f],i.push(e.update(b));return i}},"class-*":function(a,b){var c;return c=" "+a.className+" ",!b==(-1!==c.indexOf(" "+this.args[0]+" "))?a.className=b?""+a.className+" "+this.args[0]:c.replace(" "+this.args[0]+" "," ").trim():void 0},"*":function(a,b){return b?a.setAttribute(this.type,b):a.removeAttribute(this.type)}},a.components={},a.config={preloadData:!0,handler:function(a,b,c){return this.call(a,b,c.view.models)}},a.formatters={},a.factory=function(b){return b._=a,b.binders=a.binders,b.components=a.components,b.formatters=a.formatters,b.config=a.config,b.configure=function(b){var c,d;null==b&&(b={});for(c in b)d=b[c],a.config[c]=d},b.bind=function(b,c,d){var e;return null==c&&(c={}),null==d&&(d={}),e=new a.View(b,c,d),e.bind(),e}},"object"==typeof exports?a.factory(exports):"function"==typeof define&&define.amd?define(["exports"],function(b){return a.factory(this.rivets=b),b}):a.factory(this.rivets={})}.call(this); | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | { | 1 | { |
2 | "name": "rivets", | 2 | "name": "rivets", |
3 | "description": "Declarative data binding facility.", | 3 | "description": "Declarative data binding facility.", |
4 | "version": "0.5.11", | 4 | "version": "0.5.12", |
5 | "author": "Michael Richards", | 5 | "author": "Michael Richards", |
6 | "url": "http://rivetsjs.com", | 6 | "url": "http://rivetsjs.com", |
7 | "main": "./dist/rivets.js", | 7 | "main": "./dist/rivets.js", | ... | ... |
-
Please register or sign in to post a comment