Permalink
Browse files

the checked binding now casts model values to strings for comparison …

…with radio binding values (use case: true === 'true' for clients that want Yes/No radio buttons instead of just using a checkbox)
  • Loading branch information...
1 parent 7ebdf04 commit c594d492aa38f0da6be700566f07f7c240c4d4d3 @politician committed Feb 27, 2012
Showing with 5 additions and 3 deletions.
  1. +5 −3 outback.js
View
@@ -887,10 +887,12 @@
}
function domWrite($el, actual) {
- var checked;
+ var checked, value, comparand;
switch($el.attr('type')) {
case 'radio':
- checked = $el.val() === actual
+ value = $el.val();
+ comparand = _.isString(value) ? '' + actual : actual;
+ checked = value === comparand
$el.prop('checked', checked);
break;
@@ -987,6 +989,6 @@
$(element).text(text);
}
}
- })();
+ })();
}));

0 comments on commit c594d49

Please sign in to comment.