| 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 [Element] API. */ | 7 /** Extensions to the [Element] API. */ |
| 8 class _ElementExtension extends NodeBindExtension { | 8 class _ElementExtension extends NodeBindExtension { |
| 9 _ElementExtension(Element node) : super._(node); | 9 _ElementExtension(Element node) : super._(node); |
| 10 | 10 |
| 11 NodeBinding bind(String name, model, [String path]) { | 11 NodeBinding bind(String name, model, [String path]) { |
| 12 _self.unbind(name); | 12 _self.unbind(name); |
| 13 | 13 |
| 14 var binding; | 14 var binding; |
| 15 if (_node is OptionElement && name == 'value') { | 15 if (_node is OptionElement && name == 'value') { |
| 16 // Note: because <option> can be a semantic template, <option> will be | 16 // Note: because <option> can be a semantic template, <option> will be |
| 17 // a TemplateBindExtension sometimes. So we need to handle it here. | 17 // a TemplateBindExtension sometimes. So we need to handle it here. |
| 18 _node.attributes.remove(name); | 18 (_node as OptionElement).attributes.remove(name); |
| 19 binding = new _OptionValueBinding(_node, model, path); | 19 binding = new _OptionValueBinding(_node, model, path); |
| 20 } else { | 20 } else { |
| 21 binding = new _AttributeBinding(_node, name, model, path); | 21 binding = new _AttributeBinding(_node, name, model, path); |
| 22 } | 22 } |
| 23 return bindings[name] = binding; | 23 return bindings[name] = binding; |
| 24 } | 24 } |
| 25 } | 25 } |
| 26 | 26 |
| 27 class _AttributeBinding extends NodeBinding { | 27 class _AttributeBinding extends NodeBinding { |
| 28 final bool conditional; | 28 final bool conditional; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 } | 74 } |
| 75 | 75 |
| 76 super.valueChanged(newValue); | 76 super.valueChanged(newValue); |
| 77 | 77 |
| 78 if (selectBinding != null && !selectBinding.closed && | 78 if (selectBinding != null && !selectBinding.closed && |
| 79 select.value != oldValue) { | 79 select.value != oldValue) { |
| 80 selectBinding.nodeValueChanged(null); | 80 selectBinding.nodeValueChanged(null); |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 } | 83 } |
| OLD | NEW |