Appendhtml() Doesn't Append The Full Html - Dart
The following code works as expected in DartPad, demonstrated below: void main() { Element e = querySelector('table'); String someValue = 'hello, world'; int anotherValue =
Solution 1:
Dart 1.11 made a change to appendHTML to sanitize the HTML input.
To avoid this, you can pass a sanitizer that does nothing.
classMySanitizer implements NodeTreeSanitizer {
voidsanitizeTree(Node node) {}
}
document.body.appendHtml('<td>fish</td>', treeSanitizer: newMySanitizer());
Solution 2:
It's a bug. Should be fixed in bleeding edge very shortly, fix is in review. Basically, sanitization creates a document fragment to sanitize. It wasn't correctly using the context, so it tried to create it as it it was under body, and table elements don't work there.
Solution 3:
This is because JS does not support multiline strings, you would need to structure it like this:
'<td>TEXT</td>' +
'<td>TEXT2</td>'
OR:
'<td>TEXT</td><td>TEXT2</td>'
Post a Comment for "Appendhtml() Doesn't Append The Full Html - Dart"