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

Unified Diff: lib/dom/templates/html/impl/impl_DocumentFragment.darttemplate

Issue 10868026: Adding .toggle method to Element.classes to match the JS element.classList.toggle method. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Adding CSSClassSet to wrappers and converting it to a frozen API on DocumentFragment. Created 8 years, 4 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
Index: lib/dom/templates/html/impl/impl_DocumentFragment.darttemplate
diff --git a/lib/dom/templates/html/impl/impl_DocumentFragment.darttemplate b/lib/dom/templates/html/impl/impl_DocumentFragment.darttemplate
index 643e1b10d1e99580ee639f31eb455fed5cafa243..c5184522aae9229df6100696d451bc645672ae1d 100644
--- a/lib/dom/templates/html/impl/impl_DocumentFragment.darttemplate
+++ b/lib/dom/templates/html/impl/impl_DocumentFragment.darttemplate
@@ -126,6 +126,16 @@ class EmptyElementRect implements ElementRect {
const EmptyElementRect();
}
+class _FrozenCSSClassSet extends _CssClassSet {
+ _FrozenCSSClassSet() : super(null);
+
+ void _write(Set s) {
+ throw const UnsupportedOperationException(
+ 'frozen class set cannot be modified');
+ }
+ Set<String> _read() => new Set<String>();
+}
+
class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
ElementList _elements;
@@ -224,8 +234,7 @@ class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
Element get offsetParent() => null;
Element get parent() => null;
Map<String, String> get attributes() => const {};
- // Issue 174: this should be a const set.
- Set<String> get classes() => new Set<String>();
+ CSSClassSet get classes() => new _FrozenCSSClassSet();
Map<String, String> get dataAttributes() => const {};
CSSStyleDeclaration get style() => new Element.tag('div').style;
Future<CSSStyleDeclaration> get computedStyle() =>

Powered by Google App Engine
This is Rietveld 408576698