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

Side by Side Diff: lib/html/src/XMLElementWrappingImplementation.dart

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
OLDNEW
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 class _XMLClassSet extends _CssClassSet { 5 class _XMLClassSet extends _CssClassSet {
6 _XMLClassSet(element) : super(element); 6 _XMLClassSet(element) : super(element);
7 7
8 String _className() { 8 String _className() {
9 final classStr = _element.getAttribute('class'); 9 final classStr = _element.getAttribute('class');
10 return classStr == null ? '' : classStr; 10 return classStr == null ? '' : classStr;
(...skipping 11 matching lines...) Expand all
22 22
23 factory XMLElementWrappingImplementation.xml(String xml) { 23 factory XMLElementWrappingImplementation.xml(String xml) {
24 XMLElement parentTag = new XMLElement.tag('xml'); 24 XMLElement parentTag = new XMLElement.tag('xml');
25 parentTag.innerHTML = xml; 25 parentTag.innerHTML = xml;
26 if (parentTag.nodes.length == 1) return parentTag.nodes.removeLast(); 26 if (parentTag.nodes.length == 1) return parentTag.nodes.removeLast();
27 27
28 throw new IllegalArgumentException( 28 throw new IllegalArgumentException(
29 'XML had ${parentTag.nodes.length} top-level nodes but 1 expected'); 29 'XML had ${parentTag.nodes.length} top-level nodes but 1 expected');
30 } 30 }
31 31
32 Set<String> get classes() { 32 CSSClassSet get classes() {
33 if (_cssClassSet === null) { 33 if (_cssClassSet === null) {
34 _cssClassSet = new _XMLClassSet(_ptr); 34 _cssClassSet = new _XMLClassSet(_ptr);
35 } 35 }
36 return _cssClassSet; 36 return _cssClassSet;
37 } 37 }
38 38
39 ElementList get elements() { 39 ElementList get elements() {
40 if (_elements == null) { 40 if (_elements == null) {
41 _elements = new FilteredElementList(this); 41 _elements = new FilteredElementList(this);
42 } 42 }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 182
183 void set lang(String value) { attributes['lang'] = value; } 183 void set lang(String value) { attributes['lang'] = value; }
184 184
185 String get dir() => _attr('dir'); 185 String get dir() => _attr('dir');
186 186
187 void set dir(String value) { attributes['dir'] = value; } 187 void set dir(String value) { attributes['dir'] = value; }
188 188
189 String _attr(String name, [String def = '']) => 189 String _attr(String name, [String def = '']) =>
190 attributes.containsKey(name) ? attributes[name] : def; 190 attributes.containsKey(name) ? attributes[name] : def;
191 } 191 }
OLDNEW
« no previous file with comments | « lib/html/src/XMLDocumentWrappingImplementation.dart ('k') | tests/html/documentfragment_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698