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

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

Issue 9392028: Ensure that newly-constructed elements don't have parents. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « client/html/release/htmlimpl.dart ('k') | client/html/src/SVGElementWrappingImplementation.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/html/src/ElementWrappingImplementation.dart
diff --git a/client/html/src/ElementWrappingImplementation.dart b/client/html/src/ElementWrappingImplementation.dart
index 69daec26cbc8ae63c26ffae6648b2cf723a780d6..d82ad74a1b381ec27229ee016ef6b5d3d780d2aa 100644
--- a/client/html/src/ElementWrappingImplementation.dart
+++ b/client/html/src/ElementWrappingImplementation.dart
@@ -540,17 +540,20 @@ class ElementWrappingImplementation extends NodeWrappingImplementation implement
var temp = dom.document.createElement(parentTag);
temp.innerHTML = html;
+ var element;
Jacob 2012/02/14 02:31:06 var ==> Element
if (temp.childElementCount == 1) {
- return LevelDom.wrapElement(temp.firstElementChild);
+ element = LevelDom.wrapElement(temp.firstElementChild);
} else if (parentTag == 'html' && temp.childElementCount == 2) {
// Work around for edge case in WebKit and possibly other browsers where
// both body and head elements are created even though the inner html
// only contains a head or body element.
- return LevelDom.wrapElement(temp.children.item(tag == 'head' ? 0 : 1));
+ element = LevelDom.wrapElement(temp.children.item(tag == 'head' ? 0 : 1));
} else {
throw new IllegalArgumentException('HTML had ${temp.childElementCount} ' +
'top level elements but 1 expected');
}
+ element.remove();
+ return element;
}
/** @domName Document.createElement */
« no previous file with comments | « client/html/release/htmlimpl.dart ('k') | client/html/src/SVGElementWrappingImplementation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698