diff --git a/src/snapshot.ts b/src/snapshot.ts index c5af9f58..0501f499 100644 --- a/src/snapshot.ts +++ b/src/snapshot.ts @@ -47,10 +47,10 @@ function serializeNode(n: Node, doc: Document): serializedNode | false { attributes[name] = value; } // remote css - if (tagName === 'link' && attributes.hasOwnProperty('href')) { - const stylesheet = Array.from(doc.styleSheets).find( - s => s.href === attributes.href, - ); + if (tagName === 'link') { + const stylesheet = Array.from(doc.styleSheets).find(s => { + return s.href === (n as HTMLLinkElement).href; + }); const cssText = getCssRulesString(stylesheet as CSSStyleSheet); if (cssText) { attributes = { diff --git a/test/html/iframe-inner.html b/test/html/iframe-inner.html new file mode 100644 index 00000000..2ef778d9 --- /dev/null +++ b/test/html/iframe-inner.html @@ -0,0 +1 @@ + diff --git a/test/html/iframe.html b/test/html/iframe.html new file mode 100644 index 00000000..8b45139e --- /dev/null +++ b/test/html/iframe.html @@ -0,0 +1,12 @@ + + +
+ + + +