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

Side by Side Diff: lib/html/src/DataAttributeMap.dart

Issue 10919146: Get rid of a lot of () for getters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 | « lib/html/src/CustomEventWrappingImplementation.dart ('k') | lib/html/src/Device.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 /** 5 /**
6 * Provides a Map abstraction on top of data-* attributes, similar to the 6 * Provides a Map abstraction on top of data-* attributes, similar to the
7 * dataSet in the old DOM. 7 * dataSet in the old DOM.
8 */ 8 */
9 class _DataAttributeMap implements AttributeMap { 9 class _DataAttributeMap implements AttributeMap {
10 10
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 Collection<String> getValues() { 62 Collection<String> getValues() {
63 final values = new List<String>(); 63 final values = new List<String>();
64 _attributes.forEach((String key, String value) { 64 _attributes.forEach((String key, String value) {
65 if (_matches(key)) { 65 if (_matches(key)) {
66 values.add(value); 66 values.add(value);
67 } 67 }
68 }); 68 });
69 return values; 69 return values;
70 } 70 }
71 71
72 int get length() => getKeys().length; 72 int get length => getKeys().length;
73 73
74 // TODO: Use lazy iterator when it is available on Map. 74 // TODO: Use lazy iterator when it is available on Map.
75 bool isEmpty() => length == 0; 75 bool isEmpty() => length == 0;
76 76
77 // Helpers. 77 // Helpers.
78 String _attr(String key) => 'data-$key'; 78 String _attr(String key) => 'data-$key';
79 bool _matches(String key) => key.startsWith('data-'); 79 bool _matches(String key) => key.startsWith('data-');
80 String _strip(String key) => key.substring(5); 80 String _strip(String key) => key.substring(5);
81 } 81 }
82 82
OLDNEW
« no previous file with comments | « lib/html/src/CustomEventWrappingImplementation.dart ('k') | lib/html/src/Device.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698