| 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 [SelectElement] API. */ | 7 /** Extensions to the [SelectElement] API. */ |
| 8 class _SelectElementExtension extends _ElementExtension { | 8 class _SelectElementExtension extends _ElementExtension { |
| 9 _SelectElementExtension(SelectElement node) : super(node); | 9 _SelectElementExtension(SelectElement node) : super(node); |
| 10 | 10 |
| 11 SelectElement get _node => super._node; | 11 SelectElement 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 == 'selectedindex') name = 'selectedIndex'; | 14 if (name == 'selectedindex') name = 'selectedIndex'; |
| 15 if (name != 'selectedIndex' && name != 'value') { | 15 if (name != 'selectedIndex' && name != 'value') { |
| 16 return super.bind(name, value, oneTime: oneTime); | 16 return super.bind(name, value, oneTime: oneTime); |
| 17 } | 17 } |
| 18 | 18 |
| 19 // TODO(jmesserly): merge logic here with InputElement, it's the same except | 19 // TODO(jmesserly): merge logic here with InputElement, it's the same except |
| 20 // for the addition of selectedIndex as a valid property name. | 20 // for the addition of selectedIndex as a valid property name. |
| 21 _node.attributes.remove(name); | 21 _node.attributes.remove(name); |
| 22 if (oneTime) { | 22 if (oneTime) { |
| 23 _InputBinding._updateProperty(_node, value, name); | 23 _InputBinding._updateProperty(_node, value, name); |
| 24 return null; | 24 return null; |
| 25 } | 25 } |
| 26 | 26 |
| 27 _self.unbind(name); | 27 // Option update events may need to access select bindings. |
| 28 return bindings[name] = new _InputBinding(_node, value, name); | 28 return _updateBindings(name, new _InputBinding(_node, value, name)); |
| 29 } | 29 } |
| 30 } | 30 } |
| OLD | NEW |