Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Side by Side Diff: sdk/lib/html/dart2js/html_dart2js.dart

Issue 11783017: Fixing SelectElement.options to return a read-only list. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/html/html.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 library html; 1 library html;
2 2
3 import 'dart:async'; 3 import 'dart:async';
4 import 'dart:collection'; 4 import 'dart:collection';
5 import 'dart:html_common'; 5 import 'dart:html_common';
6 import 'dart:indexed_db'; 6 import 'dart:indexed_db';
7 import 'dart:isolate'; 7 import 'dart:isolate';
8 import 'dart:json' as json; 8 import 'dart:json' as json;
9 import 'dart:math'; 9 import 'dart:math';
10 import 'dart:svg' as svg; 10 import 'dart:svg' as svg;
(...skipping 16530 matching lines...) Expand 10 before | Expand all | Expand 10 after
16541 /// @domName HTMLSelectElement.namedItem; @docsEditable true 16541 /// @domName HTMLSelectElement.namedItem; @docsEditable true
16542 Node namedItem(String name) native; 16542 Node namedItem(String name) native;
16543 16543
16544 /// @domName HTMLSelectElement.setCustomValidity; @docsEditable true 16544 /// @domName HTMLSelectElement.setCustomValidity; @docsEditable true
16545 void setCustomValidity(String error) native; 16545 void setCustomValidity(String error) native;
16546 16546
16547 16547
16548 // Override default options, since IE returns SelectElement itself and it 16548 // Override default options, since IE returns SelectElement itself and it
16549 // does not operate as a List. 16549 // does not operate as a List.
16550 List<OptionElement> get options { 16550 List<OptionElement> get options {
16551 return this.children.where((e) => e is OptionElement).toList(); 16551 var options = this.children.where((e) => e is OptionElement).toList();
16552 return new ListView<OptionElement>(options, 0, options.length);
16552 } 16553 }
16553 16554
16554 List<OptionElement> get selectedOptions { 16555 List<OptionElement> get selectedOptions {
16555 // IE does not change the selected flag for single-selection items. 16556 // IE does not change the selected flag for single-selection items.
16556 if (this.multiple) { 16557 if (this.multiple) {
16557 return this.options.where((o) => o.selected).toList(); 16558 var options = this.options.where((o) => o.selected).toList();
16559 return new ListView<OptionElement>(options, 0, options.length);
16558 } else { 16560 } else {
16559 return [this.options[this.selectedIndex]]; 16561 return [this.options[this.selectedIndex]];
16560 } 16562 }
16561 } 16563 }
16562 } 16564 }
16563 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 16565 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
16564 // for details. All rights reserved. Use of this source code is governed by a 16566 // for details. All rights reserved. Use of this source code is governed by a
16565 // BSD-style license that can be found in the LICENSE file. 16567 // BSD-style license that can be found in the LICENSE file.
16566 16568
16567 16569
(...skipping 10347 matching lines...) Expand 10 before | Expand all | Expand 10 after
26915 _position = nextPosition; 26917 _position = nextPosition;
26916 return true; 26918 return true;
26917 } 26919 }
26918 _current = null; 26920 _current = null;
26919 _position = _array.length; 26921 _position = _array.length;
26920 return false; 26922 return false;
26921 } 26923 }
26922 26924
26923 T get current => _current; 26925 T get current => _current;
26924 } 26926 }
OLDNEW
« no previous file with comments | « no previous file | tests/html/html.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698