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

Side by Side 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: Incorporating review feedback. Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | lib/dom/templates/html/impl/impl_Element.darttemplate » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 class FilteredElementList implements ElementList { 5 class FilteredElementList implements ElementList {
6 final Node _node; 6 final Node _node;
7 final NodeList _childNodes; 7 final NodeList _childNodes;
8 8
9 FilteredElementList(Node node): _childNodes = node.nodes, _node = node; 9 FilteredElementList(Node node): _childNodes = node.nodes, _node = node;
10 10
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 class EmptyElementRect implements ElementRect { 119 class EmptyElementRect implements ElementRect {
120 final ClientRect client = const _SimpleClientRect(0, 0, 0, 0); 120 final ClientRect client = const _SimpleClientRect(0, 0, 0, 0);
121 final ClientRect offset = const _SimpleClientRect(0, 0, 0, 0); 121 final ClientRect offset = const _SimpleClientRect(0, 0, 0, 0);
122 final ClientRect scroll = const _SimpleClientRect(0, 0, 0, 0); 122 final ClientRect scroll = const _SimpleClientRect(0, 0, 0, 0);
123 final ClientRect bounding = const _SimpleClientRect(0, 0, 0, 0); 123 final ClientRect bounding = const _SimpleClientRect(0, 0, 0, 0);
124 final List<ClientRect> clientRects = const <ClientRect>[]; 124 final List<ClientRect> clientRects = const <ClientRect>[];
125 125
126 const EmptyElementRect(); 126 const EmptyElementRect();
127 } 127 }
128 128
129 class _FrozenCSSClassSet extends _CssClassSet {
130 _FrozenCSSClassSet() : super(null);
131
132 void _write(Set s) {
133 throw const UnsupportedOperationException(
134 'frozen class set cannot be modified');
135 }
136 Set<String> _read() => new Set<String>();
137
138 bool get isFrozen() => true;
139 }
140
129 class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { 141 class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
130 ElementList _elements; 142 ElementList _elements;
131 143
132 ElementList get elements() { 144 ElementList get elements() {
133 if (_elements == null) { 145 if (_elements == null) {
134 _elements = new FilteredElementList(this); 146 _elements = new FilteredElementList(this);
135 } 147 }
136 return _elements; 148 return _elements;
137 } 149 }
138 150
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 String get tagName() => ""; 229 String get tagName() => "";
218 String get webkitdropzone() => ""; 230 String get webkitdropzone() => "";
219 String get webkitRegionOverflow() => ""; 231 String get webkitRegionOverflow() => "";
220 Element get $dom_firstElementChild() => elements.first(); 232 Element get $dom_firstElementChild() => elements.first();
221 Element get $dom_lastElementChild() => elements.last(); 233 Element get $dom_lastElementChild() => elements.last();
222 Element get nextElementSibling() => null; 234 Element get nextElementSibling() => null;
223 Element get previousElementSibling() => null; 235 Element get previousElementSibling() => null;
224 Element get offsetParent() => null; 236 Element get offsetParent() => null;
225 Element get parent() => null; 237 Element get parent() => null;
226 Map<String, String> get attributes() => const {}; 238 Map<String, String> get attributes() => const {};
227 // Issue 174: this should be a const set. 239 CSSClassSet get classes() => new _FrozenCSSClassSet();
228 Set<String> get classes() => new Set<String>();
229 Map<String, String> get dataAttributes() => const {}; 240 Map<String, String> get dataAttributes() => const {};
230 CSSStyleDeclaration get style() => new Element.tag('div').style; 241 CSSStyleDeclaration get style() => new Element.tag('div').style;
231 Future<CSSStyleDeclaration> get computedStyle() => 242 Future<CSSStyleDeclaration> get computedStyle() =>
232 _emptyStyleFuture(); 243 _emptyStyleFuture();
233 Future<CSSStyleDeclaration> getComputedStyle(String pseudoElement) => 244 Future<CSSStyleDeclaration> getComputedStyle(String pseudoElement) =>
234 _emptyStyleFuture(); 245 _emptyStyleFuture();
235 bool matchesSelector(String selectors) => false; 246 bool matchesSelector(String selectors) => false;
236 247
237 // Imperative Element methods are made into no-ops, as they are on parentless 248 // Imperative Element methods are made into no-ops, as they are on parentless
238 // elements. 249 // elements.
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 "WebKit drop zone can't be set for document fragments."); 348 "WebKit drop zone can't be set for document fragments.");
338 } 349 }
339 350
340 void set webkitRegionOverflow(String value) { 351 void set webkitRegionOverflow(String value) {
341 throw new UnsupportedOperationException( 352 throw new UnsupportedOperationException(
342 "WebKit region overflow can't be set for document fragments."); 353 "WebKit region overflow can't be set for document fragments.");
343 } 354 }
344 355
345 $!MEMBERS 356 $!MEMBERS
346 } 357 }
OLDNEW
« no previous file with comments | « no previous file | lib/dom/templates/html/impl/impl_Element.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698