| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |