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

Side by Side Diff: client/html/src/shared_FactoryProviders.dart

Issue 9694027: Fix a type warning for SVGElement.tag. (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
« no previous file with comments | « client/html/release/html.dart ('k') | no next file » | 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) 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 _TextFactoryProvider { 5 class _TextFactoryProvider {
6 6
7 factory Text(String data) => _document._createTextNode(data); 7 factory Text(String data) => _document._createTextNode(data);
8 } 8 }
9 9
10 class _EventFactoryProvider { 10 class _EventFactoryProvider {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 e.innerHTML = svg; 126 e.innerHTML = svg;
127 127
128 // Copy list first since we don't want liveness during iteration. 128 // Copy list first since we don't want liveness during iteration.
129 final List nodes = new List.from(e.nodes); 129 final List nodes = new List.from(e.nodes);
130 fragment.nodes.addAll(nodes); 130 fragment.nodes.addAll(nodes);
131 return fragment; 131 return fragment;
132 } 132 }
133 } 133 }
134 134
135 class _SVGElementFactoryProvider { 135 class _SVGElementFactoryProvider {
136 factory SVGElement.tag(String tag) => 136 factory SVGElement.tag(String tag) {
137 _document._createElementNS("http://www.w3.org/2000/svg", tag); 137 final Element temp =
138 _document._createElementNS("http://www.w3.org/2000/svg", tag);
139 return temp;
140 }
138 141
139 factory SVGElement.svg(String svg) { 142 factory SVGElement.svg(String svg) {
140 Element parentTag; 143 Element parentTag;
141 final match = _START_TAG_REGEXP.firstMatch(svg); 144 final match = _START_TAG_REGEXP.firstMatch(svg);
142 if (match != null && match.group(1).toLowerCase() == 'svg') { 145 if (match != null && match.group(1).toLowerCase() == 'svg') {
143 parentTag = new Element.tag('div'); 146 parentTag = new Element.tag('div');
144 } else { 147 } else {
145 parentTag = new SVGSVGElement(); 148 parentTag = new SVGSVGElement();
146 } 149 }
147 150
148 parentTag.innerHTML = svg; 151 parentTag.innerHTML = svg;
149 if (parentTag.elements.length == 1) return parentTag.nodes.removeLast(); 152 if (parentTag.elements.length == 1) return parentTag.nodes.removeLast();
150 153
151 throw new IllegalArgumentException('SVG had ${parentTag.elements.length} ' + 154 throw new IllegalArgumentException('SVG had ${parentTag.elements.length} ' +
152 'top-level elements but 1 expected'); 155 'top-level elements but 1 expected');
153 } 156 }
154 } 157 }
155 158
156 class _SVGSVGElementFactoryProvider { 159 class _SVGSVGElementFactoryProvider {
157 factory SVGSVGElement() { 160 factory SVGSVGElement() {
158 final el = new SVGElement.tag("svg"); 161 final el = new SVGElement.tag("svg");
159 // The SVG spec requires the version attribute to match the spec version 162 // The SVG spec requires the version attribute to match the spec version
160 el.attributes['version'] = "1.1"; 163 el.attributes['version'] = "1.1";
161 return el; 164 return el;
162 } 165 }
163 } 166 }
OLDNEW
« no previous file with comments | « client/html/release/html.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698