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

Unified Diff: tools/dom/src/CssClassSet.dart

Issue 11931034: Add methods to Collection. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 11 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 | « sdk/lib/svg/dartium/svg_dartium.dart ('k') | tools/dom/templates/html/impl/impl_Element.darttemplate » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/src/CssClassSet.dart
diff --git a/tools/dom/src/CssClassSet.dart b/tools/dom/src/CssClassSet.dart
index b6cbb9abee34f8929bae1ae19fab2d6d7d302925..2c875b0d087fd951f7adc24deb7ecfe3422d5813 100644
--- a/tools/dom/src/CssClassSet.dart
+++ b/tools/dom/src/CssClassSet.dart
@@ -67,11 +67,12 @@ abstract class CssClassSet implements Set<String> {
void add(String value) {
// TODO - figure out if we need to do any validation here
- // or if the browser natively does enough
+ // or if the browser natively does enough.
_modify((s) => s.add(value));
}
- bool remove(String value) {
+ bool remove(Object value) {
+ if (value is! String) return false;
Set<String> s = readClasses();
bool result = s.remove(value);
writeClasses(s);
@@ -79,7 +80,7 @@ abstract class CssClassSet implements Set<String> {
}
void addAll(Iterable<String> iterable) {
- // TODO - see comment above about validation
+ // TODO - see comment above about validation.
_modify((s) => s.addAll(iterable));
}
@@ -87,6 +88,18 @@ abstract class CssClassSet implements Set<String> {
_modify((s) => s.removeAll(iterable));
}
+ void retainAll(Iterable<String> iterable) {
+ _modify((s) => s.retainAll(iterable));
+ }
+
+ void removeMatching(bool test(String name)) {
+ _modify((s) => s.removeMatching(test));
+ }
+
+ void retainMatching(bool test(String name)) {
+ _modify((s) => s.retainMatching(test));
+ }
+
bool isSubsetOf(Collection<String> collection) =>
readClasses().isSubsetOf(collection);
« no previous file with comments | « sdk/lib/svg/dartium/svg_dartium.dart ('k') | tools/dom/templates/html/impl/impl_Element.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698