| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 html; |
| 6 |
| 5 class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { | 7 class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
| 6 $!MEMBERS | 8 $!MEMBERS |
| 7 | 9 |
| 8 // Override default options, since IE returns SelectElement itself and it | 10 // Override default options, since IE returns SelectElement itself and it |
| 9 // does not operate as a List. | 11 // does not operate as a List. |
| 10 List<OptionElement> get options { | 12 List<OptionElement> get options { |
| 11 return this.elements.filter((e) => e is OptionElement); | 13 return this.elements.filter((e) => e is OptionElement); |
| 12 } | 14 } |
| 13 | 15 |
| 14 List<OptionElement> get selectedOptions { | 16 List<OptionElement> get selectedOptions { |
| 15 // IE does not change the selected flag for single-selection items. | 17 // IE does not change the selected flag for single-selection items. |
| 16 if (this.multiple) { | 18 if (this.multiple) { |
| 17 return this.options.filter((o) => o.selected); | 19 return this.options.filter((o) => o.selected); |
| 18 } else { | 20 } else { |
| 19 return [this.options[this.selectedIndex]]; | 21 return [this.options[this.selectedIndex]]; |
| 20 } | 22 } |
| 21 } | 23 } |
| 22 } | 24 } |
| OLD | NEW |