Fix custom font preloading sometimes not working (#2493)
It didn't work if both a reference to an external style sheet and a description of a custom font are present in a style element.
This commit is contained in:
parent
3999c99af7
commit
5f02765bb1
@ -94,9 +94,9 @@ function preloadFonts(fragment: DocumentFragment): Promise<void>[] {
|
|||||||
export async function preloadResources(html: string): Promise<void> {
|
export async function preloadResources(html: string): Promise<void> {
|
||||||
template.innerHTML = html;
|
template.innerHTML = html;
|
||||||
const fragment = template.content;
|
const fragment = template.content;
|
||||||
const styleSheets = preloadStyleSheets(fragment);
|
const styleSheets = preloadStyleSheets(fragment.cloneNode(true) as DocumentFragment);
|
||||||
const images = preloadImages(fragment);
|
const images = preloadImages(fragment.cloneNode(true) as DocumentFragment);
|
||||||
const fonts = preloadFonts(fragment);
|
const fonts = preloadFonts(fragment.cloneNode(true) as DocumentFragment);
|
||||||
|
|
||||||
let timeout: number;
|
let timeout: number;
|
||||||
if (fonts.length) {
|
if (fonts.length) {
|
||||||
|
Loading…
Reference in New Issue
Block a user