Index: client/html/src/shared_FactoryProviders.dart |
diff --git a/client/html/src/shared_FactoryProviders.dart b/client/html/src/shared_FactoryProviders.dart |
index b12c663a2e1045cfcb32f86eeba85a1f5826e29e..ee5f6a4e2d7a41abe9ccbfe289033a030dbe5f4e 100644 |
--- a/client/html/src/shared_FactoryProviders.dart |
+++ b/client/html/src/shared_FactoryProviders.dart |
@@ -100,3 +100,38 @@ class _ElementFactoryProvider { |
return document._createElement(tag); |
} |
} |
+ |
+class _DocumentFragmentFactoryProvider { |
+ /** @domName Document.createDocumentFragment */ |
+ factory DocumentFragment() => document.createDocumentFragment(); |
+ |
+ factory DocumentFragment.html(String html) { |
+ var fragment = new DocumentFragment(); |
Jacob
2012/03/06 05:09:00
use final instead of var here and elsewhere.
nweiz
2012/03/06 20:10:47
Done.
|
+ fragment.innerHTML = html; |
+ return fragment; |
+ } |
+ |
+ // TODO(nweiz): enable this when XML is ported. |
+ // factory DocumentFragment.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; |
+ // } |
+ |
+ // TODO(nweiz): enable this when SVG is ported. |
+ // factory DocumentFragment.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; |
+ // } |
+} |