-
Notifications
You must be signed in to change notification settings - Fork 1.7k
How to migrate appendHtml after dart 3.7? #60564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
area-web
Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop.
type-documentation
A request to add or improve documentation
type-question
A question about expected behavior or functionality
web-libraries
Issues impacting dart:html, etc., libraries
Comments
You're talking about CC @srujzs |
Yes |
If (from abstract class Element {
void appendHtml(
String text, {
NodeValidator? validator,
NodeTreeSanitizer? treeSanitizer,
}) {
this.insertAdjacentHtml(
'beforeend',
text,
validator: validator,
treeSanitizer: treeSanitizer,
);
}
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,
),
);
}
}
@JSName('insertAdjacentHTML')
void _insertAdjacentHtml(String where, String text) native;
}
abstract class NodeTreeSanitizer {
static const NodeTreeSanitizer trusted = const _TrustedHtmlTreeSanitizer();
} Then final buffer = StringBuffer();
for (var i = 6; --i >= 0;) {
buffer.write('<tr>xxxxx</tr>');
}
table.insertAdjacentHTML('beforeend', '$buffer'.toJS); |
@ykmnkmi Thanks! |
@kevmoo I think there should be a "web apis migration" document for this kind of stuff. |
Element.html
NodeTreeSanitizer.trusted
getComputedStyle()
Loop Element collection
elem.children.clear();
elem.addEventListener(type, eventHandle, false);
allowInteropCaptureThis(void (self, _))
elem.appendHtml
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area-web
Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop.
type-documentation
A request to add or improve documentation
type-question
A question about expected behavior or functionality
web-libraries
Issues impacting dart:html, etc., libraries
The text was updated successfully, but these errors were encountered: