Build 0.3.10.
Showing
4 changed files
with
27 additions
and
4 deletions
1 | // rivets.js | 1 | // rivets.js |
2 | // version: 0.3.9 | 2 | // version: 0.3.10 |
3 | // author: Michael Richards | 3 | // author: Michael Richards |
4 | // license: MIT | 4 | // license: MIT |
5 | (function() { | 5 | (function() { |
... | @@ -381,9 +381,20 @@ | ... | @@ -381,9 +381,20 @@ |
381 | }; | 381 | }; |
382 | 382 | ||
383 | getInputValue = function(el) { | 383 | getInputValue = function(el) { |
384 | var o, _i, _len, _results; | ||
384 | switch (el.type) { | 385 | switch (el.type) { |
385 | case 'checkbox': | 386 | case 'checkbox': |
386 | return el.checked; | 387 | return el.checked; |
388 | case 'select-multiple': | ||
389 | _results = []; | ||
390 | for (_i = 0, _len = el.length; _i < _len; _i++) { | ||
391 | o = el[_i]; | ||
392 | if (o.selected) { | ||
393 | _results.push(o.value); | ||
394 | } | ||
395 | } | ||
396 | return _results; | ||
397 | break; | ||
387 | default: | 398 | default: |
388 | return el.value; | 399 | return el.value; |
389 | } | 400 | } |
... | @@ -488,7 +499,19 @@ | ... | @@ -488,7 +499,19 @@ |
488 | return el.innerHTML = value != null ? value : ''; | 499 | return el.innerHTML = value != null ? value : ''; |
489 | }, | 500 | }, |
490 | value: function(el, value) { | 501 | value: function(el, value) { |
491 | return el.value = value != null ? value : ''; | 502 | var o, _i, _len, _ref, _results; |
503 | if (el.type === 'select-multiple') { | ||
504 | if (value != null) { | ||
505 | _results = []; | ||
506 | for (_i = 0, _len = el.length; _i < _len; _i++) { | ||
507 | o = el[_i]; | ||
508 | _results.push(o.selected = (_ref = o.value, __indexOf.call(value, _ref) >= 0)); | ||
509 | } | ||
510 | return _results; | ||
511 | } | ||
512 | } else { | ||
513 | return el.value = value != null ? value : ''; | ||
514 | } | ||
492 | }, | 515 | }, |
493 | text: function(el, value) { | 516 | text: function(el, value) { |
494 | if (el.innerText != null) { | 517 | 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.3.9", | 4 | "version" : "0.3.10", |
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