Index: sdk/lib/html/dartium/html_dartium.dart |
diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart |
index 62bf3eeb517b617d84905b6ba35dd0217b821e44..69073dd77143e64bd6d6856d7d74a4f8b6529540 100644 |
--- a/sdk/lib/html/dartium/html_dartium.dart |
+++ b/sdk/lib/html/dartium/html_dartium.dart |
@@ -9412,8 +9412,10 @@ class DocumentFragment extends Node implements ParentNode { |
* Parses the specified text as HTML and adds the resulting node after the |
* last child of this document fragment. |
*/ |
- void appendHtml(String text) { |
- this.append(new DocumentFragment.html(text)); |
+ void appendHtml(String text, {NodeValidator validator, |
+ NodeTreeSanitizer, treeSanitizer}) { |
+ this.append(new DocumentFragment.html(text, validator: validator, |
+ treeSanitizer: treeSanitizer)); |
} |
/** |
@@ -12255,8 +12257,10 @@ abstract class Element extends Node implements GlobalEventHandlers, ParentNode, |
* 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); |
} |
/** |
@@ -12395,6 +12399,39 @@ abstract class Element extends Node implements GlobalEventHandlers, ParentNode, |
} |
+ /** |
+ * Parses text as an HTML fragment and inserts it into the DOM at the |
+ * specified location. |
+ * |
+ * The [where] parameter indicates where to insert the HTML fragment: |
+ * |
+ * * 'beforeBegin': Immediately before this element. |
+ * * 'afterBegin': As the first child of this element. |
+ * * 'beforeEnd': As the last child of this element. |
+ * * 'afterEnd': Immediately after this element. |
+ * |
+ * var html = '<div class="something">content</div>'; |
+ * // Inserts as the first child |
+ * document.body.insertAdjacentHtml('afterBegin', html); |
+ * var createdElement = document.body.children[0]; |
+ * print(createdElement.classes[0]); // Prints 'something' |
+ * |
+ * See also: |
+ * |
+ * * [insertAdjacentText] |
+ * * [insertAdjacentElement] |
+ */ |
+ void insertAdjacentHtml(String where, String html, {NodeValidator validator, |
+ NodeTreeSanitizer treeSanitizer}) { |
+ _insertAdjacentNode(where, new DocumentFragment.html(html, |
+ validator: validator, treeSanitizer: treeSanitizer)); |
+ } |
+ |
+ void _insertAdjacentNode(String where, Node node) { |
+ insertAdjacentElement(where, node); |
+ } |
+ |
+ |
/** Checks if this element or any of its parents match the CSS selectors. */ |
@Experimental() |
bool matchesWithAncestors(String selectors) { |
@@ -13649,7 +13686,7 @@ abstract class Element extends Node implements GlobalEventHandlers, ParentNode, |
@DomName('Element.insertAdjacentHTML') |
@DocsEditable() |
@Experimental() // untriaged |
- void insertAdjacentHtml(String where, String html) => _blink.BlinkElement.instance.insertAdjacentHTML_Callback_2_(this, where, html); |
+ void _insertAdjacentHtml(String where, String html) => _blink.BlinkElement.instance.insertAdjacentHTML_Callback_2_(this, where, html); |
@DomName('Element.insertAdjacentText') |
@DocsEditable() |