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

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

Issue 9478021: Add some sweet XML classes. (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/src/DocumentFragment.dart ('k') | client/html/src/XMLDocument.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/html/src/DocumentFragmentWrappingImplementation.dart
diff --git a/client/html/src/DocumentFragmentWrappingImplementation.dart b/client/html/src/DocumentFragmentWrappingImplementation.dart
index 612c3f1a9a953a7b362d7ca7c2626473388dc904..b50ea2aeaf9fa11b70d1412d108e56d71742e3f4 100644
--- a/client/html/src/DocumentFragmentWrappingImplementation.dart
+++ b/client/html/src/DocumentFragmentWrappingImplementation.dart
@@ -164,6 +164,28 @@ class DocumentFragmentWrappingImplementation extends NodeWrappingImplementation
return fragment;
}
+ factory DocumentFragmentWrappingImplementation.xml(String xml) {
+ var fragment = new DocumentFragment();
+ var e = new XMLElement.tag("xml");
+ e.innerHTML = xml;
+
+ // Copy list first since we don't want liveness during iteration.
+ List nodes = new List.from(e.nodes);
+ fragment.nodes.addAll(nodes);
+ return fragment;
+ }
+
+ factory DocumentFragmentWrappingImplementation.svg(String svg) {
+ var fragment = new DocumentFragment();
+ var e = new SVGSVGElement();
+ e.innerHTML = svg;
+
+ // Copy list first since we don't want liveness during iteration.
+ List nodes = new List.from(e.nodes);
+ fragment.nodes.addAll(nodes);
+ return fragment;
+ }
+
ElementList get elements() {
if (_elements == null) {
_elements = new FilteredElementList(this);
@@ -188,6 +210,8 @@ class DocumentFragmentWrappingImplementation extends NodeWrappingImplementation
String get outerHTML() => innerHTML;
+ // TODO(nweiz): Do we want to support some variant of innerHTML for XML and/or
+ // SVG strings?
void set innerHTML(String value) {
this.nodes.clear();
« no previous file with comments | « client/html/src/DocumentFragment.dart ('k') | client/html/src/XMLDocument.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698