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 Bindable bind(String name, value, {bool oneTime: false}) { | 13 Bindable bind(String name, value, {bool oneTime: false}) { |
14 if (name != 'value' && name != 'checked') { | 14 if (name != 'value' && name != 'checked') { |
15 return super.bind(name, value, oneTime: oneTime); | 15 return super.bind(name, value, oneTime: oneTime); |
16 } | 16 } |
17 | 17 |
18 _node.attributes.remove(name); | 18 _node.attributes.remove(name); |
19 if (oneTime) { | 19 if (oneTime) { |
20 _InputBinding._updateProperty(_node, value, name); | 20 _InputBinding._updateProperty(_node, value, name); |
21 return null; | 21 return null; |
22 } | 22 } |
23 | 23 |
24 _self.unbind(name); | 24 // Note: call _updateBindings to always store binding reflection, because |
25 return bindings[name] = new _InputBinding(_node, value, name); | 25 // checkboxes may need to update bindings of other checkboxes. |
| 26 return _updateBindings(name, new _InputBinding(_node, value, name)); |
26 } | 27 } |
27 } | 28 } |
OLD | NEW |