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

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

Issue 1154423009: Make it easier and more efficient to use trusted HTML text (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Formatting Created 5 years, 7 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 | « tools/dom/src/Validators.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/templates/html/impl/impl_Element.darttemplate
diff --git a/tools/dom/templates/html/impl/impl_Element.darttemplate b/tools/dom/templates/html/impl/impl_Element.darttemplate
index f5b165be4a4666d79a7bff1eefa9583d5d6889bd..fcf3c0c9dfe970c497c3813bfbd7b1dca08a4297 100644
--- a/tools/dom/templates/html/impl/impl_Element.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Element.darttemplate
@@ -1014,8 +1014,12 @@ $endif
*/
void insertAdjacentHtml(String where, String html, {NodeValidator validator,
NodeTreeSanitizer treeSanitizer}) {
- _insertAdjacentNode(where, new DocumentFragment.html(html,
- validator: validator, treeSanitizer: treeSanitizer));
+ if (treeSanitizer is _TrustedHtmlTreeSanitizer) {
+ _insertAdjacentHtml(where, html);
+ } else {
+ _insertAdjacentNode(where, new DocumentFragment.html(html,
+ validator: validator, treeSanitizer: treeSanitizer));
+ }
}
$if DART2JS
@@ -1374,8 +1378,12 @@ $endif
void setInnerHtml(String html,
{NodeValidator validator, NodeTreeSanitizer treeSanitizer}) {
text = null;
- append(createFragment(
- html, validator: validator, treeSanitizer: treeSanitizer));
+ if (treeSanitizer is _TrustedHtmlTreeSanitizer) {
+ _innerHtml = html;
+ } else {
+ append(createFragment(
+ html, validator: validator, treeSanitizer: treeSanitizer));
+ }
}
String get innerHtml => _innerHtml;
« no previous file with comments | « tools/dom/src/Validators.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698