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 = '
0; print(createdElement.classes0); // Prints 'something'
See also:
void insertAdjacentHtml(String where, String html,
{NodeValidator validator, NodeTreeSanitizer treeSanitizer}) {
if (treeSanitizer is _TrustedHtmlTreeSanitizer) {
_insertAdjacentHtml(where, html);
} else {
_insertAdjacentNode(
where,
createFragment(html,
validator: validator, treeSanitizer: treeSanitizer));
}
}
© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.5.0/dart-html/Element/insertAdjacentHtml.html