OLD | NEW |
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 | 8 |
9 bool containsValue(String value) { | 9 bool containsValue(String value) { |
10 for (var v in this.values) { | 10 for (var v in this.values) { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 return value; | 99 return value; |
100 } | 100 } |
101 | 101 |
102 /** | 102 /** |
103 * The number of {key, value} pairs in the map. | 103 * The number of {key, value} pairs in the map. |
104 */ | 104 */ |
105 int get length { | 105 int get length { |
106 return keys.length; | 106 return keys.length; |
107 } | 107 } |
108 | 108 |
109 bool _matches(Node node) => node.$dom_namespaceURI == null; | 109 bool _matches(Node node) => node.$dom_namespaceUri == null; |
110 } | 110 } |
111 | 111 |
112 /** | 112 /** |
113 * Wrapper to expose namespaced attributes as a typed map. | 113 * Wrapper to expose namespaced attributes as a typed map. |
114 */ | 114 */ |
115 class _NamespacedAttributeMap extends _AttributeMap { | 115 class _NamespacedAttributeMap extends _AttributeMap { |
116 | 116 |
117 final Element _element; | 117 final Element _element; |
118 final String _namespace; | 118 final String _namespace; |
119 | 119 |
(...skipping 17 matching lines...) Expand all Loading... |
137 return value; | 137 return value; |
138 } | 138 } |
139 | 139 |
140 /** | 140 /** |
141 * The number of {key, value} pairs in the map. | 141 * The number of {key, value} pairs in the map. |
142 */ | 142 */ |
143 int get length { | 143 int get length { |
144 return keys.length; | 144 return keys.length; |
145 } | 145 } |
146 | 146 |
147 bool _matches(Node node) => node.$dom_namespaceURI == _namespace; | 147 bool _matches(Node node) => node.$dom_namespaceUri == _namespace; |
148 } | 148 } |
149 | 149 |
150 | 150 |
151 /** | 151 /** |
152 * Provides a Map abstraction on top of data-* attributes, similar to the | 152 * Provides a Map abstraction on top of data-* attributes, similar to the |
153 * dataSet in the old DOM. | 153 * dataSet in the old DOM. |
154 */ | 154 */ |
155 class _DataAttributeMap implements Map<String, String> { | 155 class _DataAttributeMap implements Map<String, String> { |
156 | 156 |
157 final Map<String, String> $dom_attributes; | 157 final Map<String, String> $dom_attributes; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 int get length => keys.length; | 214 int get length => keys.length; |
215 | 215 |
216 // TODO: Use lazy iterator when it is available on Map. | 216 // TODO: Use lazy iterator when it is available on Map. |
217 bool get isEmpty => length == 0; | 217 bool get isEmpty => length == 0; |
218 | 218 |
219 // Helpers. | 219 // Helpers. |
220 String _attr(String key) => 'data-$key'; | 220 String _attr(String key) => 'data-$key'; |
221 bool _matches(String key) => key.startsWith('data-'); | 221 bool _matches(String key) => key.startsWith('data-'); |
222 String _strip(String key) => key.substring(5); | 222 String _strip(String key) => key.substring(5); |
223 } | 223 } |
OLD | NEW |