c60e14e6 by Michael Richards

Merge pull request #17 from rfunduk/master

`setAttribute` doesn't correctly change checked state.
2 parents 713507c2 857194e0
...@@ -151,11 +151,18 @@ ...@@ -151,11 +151,18 @@
151 151
152 attributeBinding = function(attr) { 152 attributeBinding = function(attr) {
153 return function(el, value) { 153 return function(el, value) {
154 switch (attr) {
155 case 'checked':
156 el.setAttribute('checked', value);
157 el.checked = value;
158 return el.defaultChecked = value;
159 default:
154 if (value) { 160 if (value) {
155 return el.setAttribute(attr, value); 161 return el.setAttribute(attr, value);
156 } else { 162 } else {
157 return el.removeAttribute(attr); 163 return el.removeAttribute(attr);
158 } 164 }
165 }
159 }; 166 };
160 }; 167 };
161 168
......
...@@ -86,7 +86,16 @@ getInputValue = (el) -> ...@@ -86,7 +86,16 @@ getInputValue = (el) ->
86 # Returns an attribute binding routine for the specified attribute. This is what 86 # Returns an attribute binding routine for the specified attribute. This is what
87 # `registerBinding` falls back to when there is no routine for the binding type. 87 # `registerBinding` falls back to when there is no routine for the binding type.
88 attributeBinding = (attr) -> (el, value) -> 88 attributeBinding = (attr) -> (el, value) ->
89 if value then el.setAttribute attr, value else el.removeAttribute attr 89 switch attr
90 when 'checked'
91 el.setAttribute( 'checked', value )
92 el.checked = value
93 el.defaultChecked = value
94 else
95 if value
96 el.setAttribute attr, value
97 else
98 el.removeAttribute attr
90 99
91 # Returns a state binding routine for the specified attribute. Can optionally be 100 # Returns a state binding routine for the specified attribute. Can optionally be
92 # negatively evaluated. This is used to build a lot of the core state binding 101 # negatively evaluated. This is used to build a lot of the core state binding
......