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,6 +405,15 @@
getInputValue = function(el) {
var o, _i, _len, _results;
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;
......@@ -421,6 +430,7 @@
default:
return el.value;
}
}
};
Rivets.binders = {
......@@ -482,20 +492,27 @@
return unbindEvent(el, 'change', this.currentListener);
},
routine: function(el, value) {
var o, _i, _len, _ref, _ref1, _results;
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 = (_ref = o.value, __indexOf.call(value, _ref) >= 0));
_results.push(o.selected = (_ref1 = o.value, __indexOf.call(value, _ref1) >= 0));
}
return _results;
}
} else if ((value != null ? value.toString() : void 0) !== ((_ref1 = el.value) != null ? _ref1.toString() : void 0)) {
} else if ((value != null ? value.toString() : void 0) !== ((_ref2 = el.value) != null ? _ref2.toString() : void 0)) {
return el.value = value != null ? value : '';
}
}
}
},
text: function(el, value) {
if (el.innerText != null) {
......
{
"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
......