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

Unified Diff: lib/html/src/DataAttributeMap.dart

Issue 10910129: Remove stale files from lib/html/src. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/html/src/CustomEventWrappingImplementation.dart ('k') | lib/html/src/DeviceMotionEvent.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/html/src/DataAttributeMap.dart
diff --git a/lib/html/src/DataAttributeMap.dart b/lib/html/src/DataAttributeMap.dart
deleted file mode 100644
index 7c754e9fa6e64ff149236bec4a5c98ef51a25958..0000000000000000000000000000000000000000
--- a/lib/html/src/DataAttributeMap.dart
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/**
- * Provides a Map abstraction on top of data-* attributes, similar to the
- * dataSet in the old DOM.
- */
-class _DataAttributeMap implements AttributeMap {
-
- final Map<String, String> _attributes;
-
- _DataAttributeMap(this._attributes);
-
- // interface Map
-
- // TODO: Use lazy iterator when it is available on Map.
- bool containsValue(String value) => getValues().some((v) => v == value);
-
- bool containsKey(String key) => _attributes.containsKey(_attr(key));
-
- String operator [](String key) => _attributes[_attr(key)];
-
- void operator []=(String key, value) {
- _attributes[_attr(key)] = '$value';
- }
-
- String putIfAbsent(String key, String ifAbsent()) {
- if (!containsKey(key)) {
- return this[key] = ifAbsent();
- }
- return this[key];
- }
-
- String remove(String key) => _attributes.remove(_attr(key));
-
- void clear() {
- // Needs to operate on a snapshot since we are mutatiting the collection.
- for (String key in getKeys()) {
- remove(key);
- }
- }
-
- void forEach(void f(String key, String value)) {
- _attributes.forEach((String key, String value) {
- if (_matches(key)) {
- f(_strip(key), value);
- }
- });
- }
-
- Collection<String> getKeys() {
- final keys = new List<String>();
- _attributes.forEach((String key, String value) {
- if (_matches(key)) {
- keys.add(_strip(key));
- }
- });
- return keys;
- }
-
- Collection<String> getValues() {
- final values = new List<String>();
- _attributes.forEach((String key, String value) {
- if (_matches(key)) {
- values.add(value);
- }
- });
- return values;
- }
-
- int get length() => getKeys().length;
-
- // TODO: Use lazy iterator when it is available on Map.
- bool isEmpty() => length == 0;
-
- // Helpers.
- String _attr(String key) => 'data-$key';
- bool _matches(String key) => key.startsWith('data-');
- String _strip(String key) => key.substring(5);
-}
-
« no previous file with comments | « lib/html/src/CustomEventWrappingImplementation.dart ('k') | lib/html/src/DeviceMotionEvent.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698