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

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

Issue 1123173003: Another try at appendHtml and insertAdjacentHtml should be consistently sanitized (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
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 d18eb4b94f78b6cb6df62d7d676c05d7fbbff32c..10f842c74ff0f1de135bd9c53c130572f033a31a 100644
--- a/tools/dom/templates/html/impl/impl_Element.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Element.darttemplate
@@ -727,8 +727,10 @@ $(ANNOTATIONS)$(NATIVESPEC)abstract class $CLASSNAME$EXTENDS$IMPLEMENTS {
* Parses the specified text as HTML and adds the resulting node after the
* last child of this element.
*/
- void appendHtml(String text) {
- this.insertAdjacentHtml('beforeend', text);
+ void appendHtml(String text, {NodeValidator validator,
+ NodeTreeSanitizer treeSanitizer}) {
+ this.insertAdjacentHtml('beforeend', text, validator: validator,
+ treeSanitizer: treeSanitizer);
}
/**
@@ -984,6 +986,9 @@ $if DART2JS
@JSName('insertAdjacentText')
void _insertAdjacentText(String where, String text) native;
+
+$else
+$endif
/**
* Parses text as an HTML fragment and inserts it into the DOM at the
@@ -1007,14 +1012,14 @@ $if DART2JS
* * [insertAdjacentText]
* * [insertAdjacentElement]
*/
- void insertAdjacentHtml(String where, String html) {
- if (JS('bool', '!!#.insertAdjacentHTML', this)) {
- _insertAdjacentHtml(where, html);
- } else {
- _insertAdjacentNode(where, new DocumentFragment.html(html));
- }
+ void insertAdjacentHtml(String where, String html, {NodeValidator validator,
+ NodeTreeSanitizer treeSanitizer}) {
+ _insertAdjacentNode(where, new DocumentFragment.html(html,
+ validator: validator, treeSanitizer: treeSanitizer));
}
+$if DART2JS
+
@JSName('insertAdjacentHTML')
void _insertAdjacentHtml(String where, String text) native;
@@ -1039,6 +1044,8 @@ $if DART2JS
@JSName('insertAdjacentElement')
void _insertAdjacentElement(String where, Element element) native;
+$else
+$endif
void _insertAdjacentNode(String where, Node node) {
switch (where.toLowerCase()) {
@@ -1060,6 +1067,7 @@ $if DART2JS
}
}
+$if DART2JS
/**
* Checks if this element matches the CSS selectors.
*/

Powered by Google App Engine
This is Rietveld 408576698