Chromium Code Reviews| Index: sdk/lib/html/html_common/css_class_set.dart |
| diff --git a/tools/dom/src/CssClassSet.dart b/sdk/lib/html/html_common/css_class_set.dart |
| similarity index 77% |
| rename from tools/dom/src/CssClassSet.dart |
| rename to sdk/lib/html/html_common/css_class_set.dart |
| index acae69c9743377cc71300c1e4ce0b8f54e550a5e..7fc44894af36045f68173482cc3b15be926e89a0 100644 |
| --- a/tools/dom/src/CssClassSet.dart |
| +++ b/sdk/lib/html/html_common/css_class_set.dart |
| @@ -2,10 +2,76 @@ |
| // 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. |
| -part of html; |
| +part of html_common; |
| +/** A Set that stores the CSS class names for an element. */ |
| abstract class CssClassSet implements Set<String> { |
|
blois
2013/05/03 23:20:18
The public interface should remain in dart:html, n
|
| + /** |
| + * Adds the class [value] to the element if it is not on it, removes it if it |
| + * is. |
| + */ |
| + bool toggle(String value); |
| + |
| + /** |
| + * Returns [:true:] if classes cannot be added or removed from this |
| + * [:CssClassSet:]. |
| + */ |
| + bool get frozen; |
| + |
| + /** |
| + * Determine if this element contains the class [value]. |
| + * |
| + * This is the Dart equivalent of jQuery's |
| + * [hasClass](http://api.jquery.com/hasClass/). |
| + */ |
| + bool contains(String value); |
| + |
| + /** |
| + * Add the class [value] to element. |
| + * |
| + * This is the Dart equivalent of jQuery's |
| + * [addClass](http://api.jquery.com/addClass/). |
| + */ |
| + void add(String value); |
| + |
| + /** |
| + * Remove the class [value] from element, and return true on successful |
| + * removal. |
| + * |
| + * This is the Dart equivalent of jQuery's |
| + * [removeClass](http://api.jquery.com/removeClass/). |
| + */ |
| + bool remove(Object value); |
| + |
| + /** |
| + * Add all classes specified in [iterable] to element. |
| + * |
| + * This is the Dart equivalent of jQuery's |
| + * [addClass](http://api.jquery.com/addClass/). |
| + */ |
| + void addAll(Iterable<String> iterable); |
| + |
| + /** |
| + * Remove all classes specified in [iterable] from element. |
| + * |
| + * This is the Dart equivalent of jQuery's |
| + * [removeClass](http://api.jquery.com/removeClass/). |
| + */ |
| + void removeAll(Iterable<String> iterable); |
| + |
| + /** |
| + * Toggles all classes specified in [iterable] on element. |
| + * |
| + * Iterate through [iterable]'s items, and add it if it is not on it, or |
| + * remove it if it is. This is the Dart equivalent of jQuery's |
| + * [toggleClass](http://api.jquery.com/toggleClass/). |
| + */ |
| + void toggleAll(Iterable<String> iterable); |
| +} |
| + |
| +abstract class CssClassSetImpl implements CssClassSet { |
| + |
| String toString() { |
| return readClasses().join(' '); |
| } |