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

Side by Side Diff: client/dom/templates/html/impl/impl_SVGElement.darttemplate

Issue 9677012: Port the SVG code to the wrapperless DOM. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 class _AttributeClassSet extends _CssClassSet {
6 _AttributeClassSet(element) : super(element);
7
8 String _className() => _element.attributes['class'];
9
10 void _write(Set s) {
11 _element.attributes['class'] = _formatSet(s);
12 }
13 }
14
15 class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
16 Set<String> get classes() {
17 if (_cssClassSet === null) {
18 _cssClassSet = new _AttributeClassSet(_ptr);
19 }
20 return _cssClassSet;
21 }
22
23 ElementList get elements() => new FilteredElementList(this);
24
25 void set elements(Collection<Element> value) {
26 final elements = this.elements;
27 elements.clear();
28 elements.addAll(value);
29 }
30
31 String get outerHTML() {
32 final container = new Element.tag("div");
33 final SVGElement clone = this.clone(true);
34 container.elements.add(clone);
35 return container.innerHTML;
36 }
37
38 String get innerHTML() {
39 final container = new Element.tag("div");
40 final SVGElement clone = this.clone(true);
41 container.elements.addAll(clone.elements);
42 return container.innerHTML;
43 }
44
45 void set innerHTML(String svg) {
46 final container = new Element.tag("div");
47 // Wrap the SVG string in <svg> so that SVGElements are created, rather than
48 // HTMLElements.
49 container.innerHTML = '<svg version="1.1">$svg</svg>';
50 this.elements = container.elements.first.elements;
51 }
52
53 $!MEMBERS
54 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698