diff --git a/src/clone-node.ts b/src/clone-node.ts index 09236ab..37bf0fc 100644 --- a/src/clone-node.ts +++ b/src/clone-node.ts @@ -97,9 +97,10 @@ export async function cloneNode( applyCssStyleWithOptions(cloneStyle, context) } - if (cloneStyle.fontFamily) { - cloneStyle.fontFamily.split(',').forEach(val => fontFamilies.add(val)) - } + cloneStyle.getPropertyValue('font-family') + .split(',') + .filter(Boolean) + .forEach(val => fontFamilies.add(val)) copyPseudoContent(node, clone, ownerWindow) diff --git a/src/embed-web-font.ts b/src/embed-web-font.ts index cf5b93a..e7487a3 100644 --- a/src/embed-web-font.ts +++ b/src/embed-web-font.ts @@ -78,7 +78,10 @@ export async function embedWebFont( .filter(cssRule => ( isCssFontFaceRule(cssRule) && hasCssUrl(cssRule.style.getPropertyValue('src')) - && cssRule.style.fontFamily.split(',').some(val => fontFamilies.has(val)) + && cssRule.style.getPropertyValue('font-family') + .split(',') + .filter(Boolean) + .some(val => fontFamilies.has(val)) )) .forEach((value) => { const rule = value as CSSFontFaceRule