Index: client/html/src/shared_FactoryProviders.dart |
diff --git a/client/html/src/shared_FactoryProviders.dart b/client/html/src/shared_FactoryProviders.dart |
index b9fb9f5efc8ff10d1c9a3527b848b3a9e3abe2cc..7e13bfb10440002713c535bf158bdba37492b57a 100644 |
--- a/client/html/src/shared_FactoryProviders.dart |
+++ b/client/html/src/shared_FactoryProviders.dart |
@@ -32,7 +32,7 @@ class _MouseEventFactoryProvider { |
class _CSSStyleDeclarationFactoryProvider { |
factory CSSStyleDeclaration.css(String css) { |
- var style = new Element.tag('div').style; |
+ final style = new Element.tag('div').style; |
style.cssText = css; |
return style; |
} |
@@ -97,3 +97,38 @@ class _ElementFactoryProvider { |
/** @domName Document.createElement */ |
factory Element.tag(String tag) => _document._createElement(tag); |
} |
+ |
+class _DocumentFragmentFactoryProvider { |
+ /** @domName Document.createDocumentFragment */ |
+ factory DocumentFragment() => document.createDocumentFragment(); |
+ |
+ factory DocumentFragment.html(String html) { |
+ final fragment = new DocumentFragment(); |
+ fragment.innerHTML = html; |
+ return fragment; |
+ } |
+ |
+ // TODO(nweiz): enable this when XML is ported. |
+ // factory DocumentFragment.xml(String xml) { |
+ // final fragment = new DocumentFragment(); |
+ // final e = new XMLElement.tag("xml"); |
+ // e.innerHTML = xml; |
+ // |
+ // // Copy list first since we don't want liveness during iteration. |
+ // final 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) { |
+ // final fragment = new DocumentFragment(); |
+ // final e = new SVGSVGElement(); |
+ // e.innerHTML = svg; |
+ // |
+ // // Copy list first since we don't want liveness during iteration. |
+ // final List nodes = new List.from(e.nodes); |
+ // fragment.nodes.addAll(nodes); |
+ // return fragment; |
+ // } |
+} |