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

Unified Diff: tools/dom/templates/html/impl/impl_DocumentFragment.darttemplate

Issue 23523002: Revert "First rev of Safe DOM" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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
Index: tools/dom/templates/html/impl/impl_DocumentFragment.darttemplate
diff --git a/tools/dom/templates/html/impl/impl_DocumentFragment.darttemplate b/tools/dom/templates/html/impl/impl_DocumentFragment.darttemplate
index 199b67ad3359fa261cf7b67adefafd2784230ccd..8cbbf2c27ef301b3b2b1ec25d28b9fe305686a3d 100644
--- a/tools/dom/templates/html/impl/impl_DocumentFragment.darttemplate
+++ b/tools/dom/templates/html/impl/impl_DocumentFragment.darttemplate
@@ -7,18 +7,21 @@ part of $LIBRARYNAME;
$(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
factory $CLASSNAME() => document.createDocumentFragment();
- factory $CLASSNAME.html(String html,
- {NodeValidator validator, NodeTreeSanitizer treeSanitizer}) {
-
- return document.body.createFragment(html,
- validator: validator, treeSanitizer: treeSanitizer);
+ factory $CLASSNAME.html(String html) {
+ final fragment = new DocumentFragment();
+ fragment.innerHtml = html;
+ return fragment;
}
- factory $CLASSNAME.svg(String svgContent,
- {NodeValidator validator, NodeTreeSanitizer treeSanitizer}) {
+ factory $CLASSNAME.svg(String svgContent) {
+ final fragment = new DocumentFragment();
+ final e = new svg.SvgSvgElement();
+ e.innerHtml = svgContent;
- return new svg.SvgSvgElement().createFragment(svgContent,
- validator: validator, treeSanitizer: treeSanitizer);
+ // 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;
}
$if DART2JS
@@ -54,16 +57,17 @@ $endif
return e.innerHtml;
}
+ // TODO(nweiz): Do we want to support some variant of innerHtml for XML and/or
+ // SVG strings?
void set innerHtml(String value) {
- this.setInnerHtml(value);
- }
+ this.nodes.clear();
- void setInnerHtml(String html,
- {NodeValidator validator, NodeTreeSanitizer treeSanitizer}) {
+ final e = new Element.tag("div");
+ e.innerHtml = value;
- this.nodes.clear();
- append(document.body.createFragment(
- html, validator: validator, treeSanitizer: treeSanitizer));
+ // Copy list first since we don't want liveness during iteration.
+ List nodes = new List.from(e.nodes, growable: false);
+ this.nodes.addAll(nodes);
}
/**
« no previous file with comments | « tools/dom/templates/html/dartium/html_dartium.darttemplate ('k') | tools/dom/templates/html/impl/impl_Element.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698