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

Side by Side Diff: tools/dom/src/AttributeMap.dart

Issue 103933005: Fix bug 15417 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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
OLDNEW
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; 5 part of html;
6 6
7 abstract class _AttributeMap implements Map<String, String> { 7 abstract class _AttributeMap implements Map<String, String> {
8 final Element _element; 8 final Element _element;
9 9
10 _AttributeMap(this._element); 10 _AttributeMap(this._element);
11 11
12 void addAll(Map<String, String> other) {
13 other.forEach((k, v) { this[k] = v; });
14 }
15
12 bool containsValue(String value) { 16 bool containsValue(String value) {
13 for (var v in this.values) { 17 for (var v in this.values) {
14 if (value == v) { 18 if (value == v) {
15 return true; 19 return true;
16 } 20 }
17 } 21 }
18 return false; 22 return false;
19 } 23 }
20 24
21 String putIfAbsent(String key, String ifAbsent()) { 25 String putIfAbsent(String key, String ifAbsent()) {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 * dataSet in the old DOM. 162 * dataSet in the old DOM.
159 */ 163 */
160 class _DataAttributeMap implements Map<String, String> { 164 class _DataAttributeMap implements Map<String, String> {
161 165
162 final Map<String, String> _attributes; 166 final Map<String, String> _attributes;
163 167
164 _DataAttributeMap(this._attributes); 168 _DataAttributeMap(this._attributes);
165 169
166 // interface Map 170 // interface Map
167 171
172 void addAll(Map<String, String> other) {
173 other.forEach((k, v) { this[k] = v; });
174 }
175
168 // TODO: Use lazy iterator when it is available on Map. 176 // TODO: Use lazy iterator when it is available on Map.
169 bool containsValue(String value) => values.any((v) => v == value); 177 bool containsValue(String value) => values.any((v) => v == value);
170 178
171 bool containsKey(String key) => _attributes.containsKey(_attr(key)); 179 bool containsKey(String key) => _attributes.containsKey(_attr(key));
172 180
173 String operator [](String key) => _attributes[_attr(key)]; 181 String operator [](String key) => _attributes[_attr(key)];
174 182
175 void operator []=(String key, String value) { 183 void operator []=(String key, String value) {
176 _attributes[_attr(key)] = value; 184 _attributes[_attr(key)] = value;
177 } 185 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 String _toHyphenedName(String word) { 258 String _toHyphenedName(String word) {
251 var sb = new StringBuffer(); 259 var sb = new StringBuffer();
252 for (int i = 0; i < word.length; i++) { 260 for (int i = 0; i < word.length; i++) {
253 var lower = word[i].toLowerCase(); 261 var lower = word[i].toLowerCase();
254 if (word[i] != lower && i > 0) sb.write('-'); 262 if (word[i] != lower && i > 0) sb.write('-');
255 sb.write(lower); 263 sb.write(lower);
256 } 264 }
257 return sb.toString(); 265 return sb.toString();
258 } 266 }
259 } 267 }
OLDNEW
« no previous file with comments | « tools/dom/scripts/systemhtml.py ('k') | tools/dom/templates/html/impl/impl_Storage.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698