| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of template_binding; | 5 part of template_binding; |
| 6 | 6 |
| 7 /** Extensions to the [InputElement] API. */ | 7 /** Extensions to the [InputElement] API. */ |
| 8 class _InputElementExtension extends _ElementExtension { | 8 class _InputElementExtension extends _ElementExtension { |
| 9 _InputElementExtension(InputElement node) : super(node); | 9 _InputElementExtension(InputElement node) : super(node); |
| 10 | 10 |
| 11 InputElement get _node => super._node; | 11 InputElement get _node => super._node; |
| 12 | 12 |
| 13 NodeBinding createBinding(String name, model, String path) { | 13 NodeBinding bind(String name, model, [String path]) { |
| 14 if (name == 'value') { | 14 if (name != 'value' && name != 'checked') { |
| 15 // TODO(rafaelw): Maybe template should remove all binding instructions. | 15 return super.bind(name, model, path); |
| 16 _node.attributes.remove(name); | |
| 17 return new _ValueBinding(_node, model, path); | |
| 18 } | 16 } |
| 19 if (name == 'checked') { | 17 |
| 20 _node.attributes.remove(name); | 18 _self.unbind(name); |
| 21 return new _CheckedBinding(_node, model, path); | 19 _node.attributes.remove(name); |
| 22 } | 20 return bindings[name] = name == 'value' ? |
| 23 return super.createBinding(name, model, path); | 21 new _ValueBinding(_node, model, path) : |
| 22 new _CheckedBinding(_node, model, path); |
| 24 } | 23 } |
| 25 } | 24 } |
| OLD | NEW |