diff --git a/src/dom/document-cloner.ts b/src/dom/document-cloner.ts index b04ea8d..859e1db 100644 --- a/src/dom/document-cloner.ts +++ b/src/dom/document-cloner.ts @@ -109,8 +109,18 @@ export class DocumentCloner { return Promise.reject(`Error finding the ${this.referenceElement.nodeName} in the cloned document`); } - if (documentClone.fonts && documentClone.fonts.status === 'loading' && documentClone.fonts.ready) { - await documentClone.fonts.ready; + if (documentClone.fonts && documentClone.fonts.status === 'loading') { + return Promise.race([ + documentClone.fonts.ready, + new Promise((resolve) => { + const fontLoadTimer = setInterval(() => { + if (documentClone.fonts.status === 'loaded') { + clearInterval(fontLoadTimer); + resolve(); + } + }, 1000); + }) + ]); } if (/(AppleWebKit)/g.test(navigator.userAgent)) {