Build 0.4.8.
Showing
5 changed files
with
24 additions
and
7 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.4.7", | 5 | "version": "0.4.8", |
6 | "keywords": ["data binding", "templating"], | 6 | "keywords": ["data binding", "templating"], |
7 | "scripts": ["lib/rivets.js"], | 7 | "scripts": ["lib/rivets.js"], |
8 | "main": "lib/rivets.js", | 8 | "main": "lib/rivets.js", | ... | ... |
1 | // rivets.js | 1 | // rivets.js |
2 | // version: 0.4.7 | 2 | // version: 0.4.8 |
3 | // author: Michael Richards | 3 | // author: Michael Richards |
4 | // license: MIT | 4 | // license: MIT |
5 | (function() { | 5 | (function() { |
... | @@ -405,6 +405,15 @@ | ... | @@ -405,6 +405,15 @@ |
405 | 405 | ||
406 | getInputValue = function(el) { | 406 | getInputValue = function(el) { |
407 | var o, _i, _len, _results; | 407 | var o, _i, _len, _results; |
408 | if (window.jQuery != null) { | ||
409 | el = jQuery(el); | ||
410 | switch (el[0].type) { | ||
411 | case 'checkbox': | ||
412 | return el.is(':checked'); | ||
413 | default: | ||
414 | return el.val(); | ||
415 | } | ||
416 | } else { | ||
408 | switch (el.type) { | 417 | switch (el.type) { |
409 | case 'checkbox': | 418 | case 'checkbox': |
410 | return el.checked; | 419 | return el.checked; |
... | @@ -421,6 +430,7 @@ | ... | @@ -421,6 +430,7 @@ |
421 | default: | 430 | default: |
422 | return el.value; | 431 | return el.value; |
423 | } | 432 | } |
433 | } | ||
424 | }; | 434 | }; |
425 | 435 | ||
426 | Rivets.binders = { | 436 | Rivets.binders = { |
... | @@ -482,20 +492,27 @@ | ... | @@ -482,20 +492,27 @@ |
482 | return unbindEvent(el, 'change', this.currentListener); | 492 | return unbindEvent(el, 'change', this.currentListener); |
483 | }, | 493 | }, |
484 | routine: function(el, value) { | 494 | routine: function(el, value) { |
485 | var o, _i, _len, _ref, _ref1, _results; | 495 | var o, _i, _len, _ref, _ref1, _ref2, _results; |
496 | if (window.jQuery != null) { | ||
497 | el = jQuery(el); | ||
498 | if ((value != null ? value.toString() : void 0) !== ((_ref = el.val()) != null ? _ref.toString() : void 0)) { | ||
499 | return el.val(value != null ? value : ''); | ||
500 | } | ||
501 | } else { | ||
486 | if (el.type === 'select-multiple') { | 502 | if (el.type === 'select-multiple') { |
487 | if (value != null) { | 503 | if (value != null) { |
488 | _results = []; | 504 | _results = []; |
489 | for (_i = 0, _len = el.length; _i < _len; _i++) { | 505 | for (_i = 0, _len = el.length; _i < _len; _i++) { |
490 | o = el[_i]; | 506 | o = el[_i]; |
491 | _results.push(o.selected = (_ref = o.value, __indexOf.call(value, _ref) >= 0)); | 507 | _results.push(o.selected = (_ref1 = o.value, __indexOf.call(value, _ref1) >= 0)); |
492 | } | 508 | } |
493 | return _results; | 509 | return _results; |
494 | } | 510 | } |
495 | } else if ((value != null ? value.toString() : void 0) !== ((_ref1 = el.value) != null ? _ref1.toString() : void 0)) { | 511 | } else if ((value != null ? value.toString() : void 0) !== ((_ref2 = el.value) != null ? _ref2.toString() : void 0)) { |
496 | return el.value = value != null ? value : ''; | 512 | return el.value = value != null ? value : ''; |
497 | } | 513 | } |
498 | } | 514 | } |
515 | } | ||
499 | }, | 516 | }, |
500 | text: function(el, value) { | 517 | text: function(el, value) { |
501 | if (el.innerText != null) { | 518 | if (el.innerText != null) { | ... | ... |
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.4.7", | 4 | "version" : "0.4.8", |
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