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

Unified Diff: client/html/src/ElementWrappingImplementation.dart

Issue 8965006: Support SVGElement#elements, #innerHTML, and #outerHTML. Also add a .svg constructor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes. Created 9 years 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 side-by-side diff with in-line comments
Download patch
Index: client/html/src/ElementWrappingImplementation.dart
diff --git a/client/html/src/ElementWrappingImplementation.dart b/client/html/src/ElementWrappingImplementation.dart
index cf08d2e27a8c1bba3cdf60cd0c3a6a249fa342fe..ebceed45d2efe1368aca60345af131adc5f1a676 100644
--- a/client/html/src/ElementWrappingImplementation.dart
+++ b/client/html/src/ElementWrappingImplementation.dart
@@ -480,10 +480,11 @@ class ElementRectWrappingImplementation implements ElementRect {
}
}
+final _START_TAG_REGEXP = const RegExp('<(\\w+)');
+
/** @domName Element, HTMLElement */
class ElementWrappingImplementation extends NodeWrappingImplementation implements Element {
- static final _START_TAG_REGEXP = const RegExp('<(\\w+)');
static final _CUSTOM_PARENT_TAG_MAP = const {
'body' : 'html',
'head' : 'html',
@@ -528,7 +529,8 @@ class ElementWrappingImplementation extends NodeWrappingImplementation implement
// only contains a head or body element.
return LevelDom.wrapElement(temp.children.item(tag == 'head' ? 0 : 1));
} else {
- throw 'HTML had ${temp.childElementCount} top level elements but 1 expected';
+ throw new IllegalArgumentException('HTML had ${temp.childElementCount} ' +
+ 'top level elements but 1 expected');
}
}
@@ -564,11 +566,9 @@ class ElementWrappingImplementation extends NodeWrappingImplementation implement
}
void set elements(Collection<Element> value) {
- // Copy list first since we don't want liveness during iteration.
- List copy = new List.from(value);
final elements = this.elements;
elements.clear();
- elements.addAll(copy);
+ elements.addAll(value);
}
/**

Powered by Google App Engine
This is Rietveld 408576698