9a391f34 by Michael Richards

Build 0.4.8.

1 parent f5528f7a
......@@ -2,7 +2,7 @@
"name": "rivets",
"repo": "mikeric/rivets",
"description": "Declarative data binding facility.",
"version": "0.4.7",
"version": "0.4.8",
"keywords": ["data binding", "templating"],
"scripts": ["lib/rivets.js"],
"main": "lib/rivets.js",
......
// rivets.js
// version: 0.4.7
// version: 0.4.8
// author: Michael Richards
// license: MIT
(function() {
......@@ -405,21 +405,31 @@
getInputValue = function(el) {
var o, _i, _len, _results;
switch (el.type) {
case 'checkbox':
return el.checked;
case 'select-multiple':
_results = [];
for (_i = 0, _len = el.length; _i < _len; _i++) {
o = el[_i];
if (o.selected) {
_results.push(o.value);
if (window.jQuery != null) {
el = jQuery(el);
switch (el[0].type) {
case 'checkbox':
return el.is(':checked');
default:
return el.val();
}
} else {
switch (el.type) {
case 'checkbox':
return el.checked;
case 'select-multiple':
_results = [];
for (_i = 0, _len = el.length; _i < _len; _i++) {
o = el[_i];
if (o.selected) {
_results.push(o.value);
}
}
}
return _results;
break;
default:
return el.value;
return _results;
break;
default:
return el.value;
}
}
};
......@@ -482,18 +492,25 @@
return unbindEvent(el, 'change', this.currentListener);
},
routine: function(el, value) {
var o, _i, _len, _ref, _ref1, _results;
if (el.type === 'select-multiple') {
if (value != null) {
_results = [];
for (_i = 0, _len = el.length; _i < _len; _i++) {
o = el[_i];
_results.push(o.selected = (_ref = o.value, __indexOf.call(value, _ref) >= 0));
var o, _i, _len, _ref, _ref1, _ref2, _results;
if (window.jQuery != null) {
el = jQuery(el);
if ((value != null ? value.toString() : void 0) !== ((_ref = el.val()) != null ? _ref.toString() : void 0)) {
return el.val(value != null ? value : '');
}
} else {
if (el.type === 'select-multiple') {
if (value != null) {
_results = [];
for (_i = 0, _len = el.length; _i < _len; _i++) {
o = el[_i];
_results.push(o.selected = (_ref1 = o.value, __indexOf.call(value, _ref1) >= 0));
}
return _results;
}
return _results;
} else if ((value != null ? value.toString() : void 0) !== ((_ref2 = el.value) != null ? _ref2.toString() : void 0)) {
return el.value = value != null ? value : '';
}
} else if ((value != null ? value.toString() : void 0) !== ((_ref1 = el.value) != null ? _ref1.toString() : void 0)) {
return el.value = value != null ? value : '';
}
}
},
......
{
"name" : "rivets",
"description" : "Declarative data binding facility.",
"version" : "0.4.7",
"version" : "0.4.8",
"author" : "Michael Richards",
"url" : "http://rivetsjs.com",
"main" : "./lib/rivets.js",
......
# rivets.js
# version : 0.4.7
# version : 0.4.8
# author : Michael Richards
# license : MIT
......