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

Side by Side Diff: lib/html/src/SVGElementWrappingImplementation.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 _SVGClassSet extends _CssClassSet { 5 class _SVGClassSet extends _CssClassSet {
6 _SVGClassSet(element) : super(element); 6 _SVGClassSet(element) : super(element);
7 7
8 String _className() => _element.className.baseVal; 8 String _className() => _element.className.baseVal;
9 9
10 void _write(Set s) { 10 void _write(Set s) {
(...skipping 18 matching lines...) Expand all
29 } 29 }
30 30
31 parentTag.innerHTML = svg; 31 parentTag.innerHTML = svg;
32 if (parentTag.elements.length == 1) return parentTag.nodes.removeLast(); 32 if (parentTag.elements.length == 1) return parentTag.nodes.removeLast();
33 33
34 throw new IllegalArgumentException( 34 throw new IllegalArgumentException(
35 'SVG had ${parentTag.elements.length} ' 35 'SVG had ${parentTag.elements.length} '
36 'top-level elements but 1 expected'); 36 'top-level elements but 1 expected');
37 } 37 }
38 38
39 Set<String> get classes() { 39 CSSClassSet get classes() {
40 if (_cssClassSet === null) { 40 if (_cssClassSet === null) {
41 _cssClassSet = new _SVGClassSet(_ptr); 41 _cssClassSet = new _SVGClassSet(_ptr);
42 } 42 }
43 return _cssClassSet; 43 return _cssClassSet;
44 } 44 }
45 45
46 String get id() { return _ptr.id; } 46 String get id() { return _ptr.id; }
47 47
48 void set id(String value) { _ptr.id = value; } 48 void set id(String value) { _ptr.id = value; }
49 49
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 void set innerHTML(String svg) { 83 void set innerHTML(String svg) {
84 var container = new Element.tag("div"); 84 var container = new Element.tag("div");
85 // Wrap the SVG string in <svg> so that SVGElements are created, rather than 85 // Wrap the SVG string in <svg> so that SVGElements are created, rather than
86 // HTMLElements. 86 // HTMLElements.
87 container.innerHTML = '<svg version="1.1">$svg</svg>'; 87 container.innerHTML = '<svg version="1.1">$svg</svg>';
88 this.elements = container.elements.first.elements; 88 this.elements = container.elements.first.elements;
89 } 89 }
90 90
91 SVGElement clone(bool deep) => super.clone(deep); 91 SVGElement clone(bool deep) => super.clone(deep);
92 } 92 }
OLDNEW
« no previous file with comments | « lib/html/src/DocumentFragmentWrappingImplementation.dart ('k') | lib/html/src/XMLDocumentWrappingImplementation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698