absolute relative path in inline stylesheet

This commit is contained in:
Yanzhen Yu
2018-11-23 22:47:19 +08:00
parent d186a06edf
commit 49c1ba0a1f

View File

@@ -154,13 +154,17 @@ function serializeNode(n: Node, doc: Document): serializedNode | false {
const parentTagName =
n.parentNode && (n.parentNode as HTMLElement).tagName;
let textContent = (n as Text).textContent;
const isStyle = parentTagName === 'STYLE' ? true : undefined;
if (isStyle && textContent) {
textContent = absoluteToStylesheet(textContent, location.href);
}
if (parentTagName === 'SCRIPT') {
textContent = 'SCRIPT_PLACEHOLDER';
}
return {
type: NodeType.Text,
textContent: textContent || '',
isStyle: parentTagName === 'STYLE' ? true : undefined,
isStyle,
};
case n.CDATA_SECTION_NODE:
return {