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

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

Issue 10989013: Change IllegalArgumentException to ArgumentError. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated co19 test expectations. Created 8 years, 2 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 _EventFactoryProvider { 5 class _EventFactoryProvider {
6 static Event createEvent(String type, [bool canBubble = true, 6 static Event createEvent(String type, [bool canBubble = true,
7 bool cancelable = true]) { 7 bool cancelable = true]) {
8 final _EventImpl e = _document.$dom_createEvent("Event"); 8 final _EventImpl e = _document.$dom_createEvent("Event");
9 e.$dom_initEvent(type, canBubble, cancelable); 9 e.$dom_initEvent(type, canBubble, cancelable);
10 return e; 10 return e;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 final match = _START_TAG_REGEXP.firstMatch(svg); 84 final match = _START_TAG_REGEXP.firstMatch(svg);
85 if (match != null && match.group(1).toLowerCase() == 'svg') { 85 if (match != null && match.group(1).toLowerCase() == 'svg') {
86 parentTag = new Element.tag('div'); 86 parentTag = new Element.tag('div');
87 } else { 87 } else {
88 parentTag = new SVGSVGElement(); 88 parentTag = new SVGSVGElement();
89 } 89 }
90 90
91 parentTag.innerHTML = svg; 91 parentTag.innerHTML = svg;
92 if (parentTag.elements.length == 1) return parentTag.nodes.removeLast(); 92 if (parentTag.elements.length == 1) return parentTag.nodes.removeLast();
93 93
94 throw new IllegalArgumentException( 94 throw new ArgumentError(
95 'SVG had ${parentTag.elements.length} ' 95 'SVG had ${parentTag.elements.length} '
96 'top-level elements but 1 expected'); 96 'top-level elements but 1 expected');
97 } 97 }
98 } 98 }
99 99
100 class _SVGSVGElementFactoryProvider { 100 class _SVGSVGElementFactoryProvider {
101 static SVGSVGElement createSVGSVGElement() { 101 static SVGSVGElement createSVGSVGElement() {
102 final el = new SVGElement.tag("svg"); 102 final el = new SVGElement.tag("svg");
103 // The SVG spec requires the version attribute to match the spec version 103 // The SVG spec requires the version attribute to match the spec version
104 el.attributes['version'] = "1.1"; 104 el.attributes['version'] = "1.1";
105 return el; 105 return el;
106 } 106 }
107 } 107 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698