Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit f16a16e

Browse files
authored
Fix fonts.clear exception in IE11 (#19180)
1 parent 50cd3e6 commit f16a16e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/web_ui/lib/src/engine/text/font_collection.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class FontCollection {
9898
void clear() {
9999
_assetFontManager = null;
100100
_testFontManager = null;
101-
if (supportsFontLoadingApi) {
101+
if (supportsFontsClearApi) {
102102
html.document.fonts.clear();
103103
}
104104
}
@@ -313,4 +313,5 @@ class _PolyfillFontManager extends FontManager {
313313
}
314314
}
315315

316-
final bool supportsFontLoadingApi = html.document.fonts != null;
316+
final bool supportsFontLoadingApi = js_util.hasProperty(html.window, 'FontFace');
317+
final bool supportsFontsClearApi = html.document.fonts != null && js_util.hasProperty(html.document.fonts, 'clear');

0 commit comments

Comments
 (0)