absolute relative path in inline stylesheet
This commit is contained in:
@@ -154,13 +154,17 @@ function serializeNode(n: Node, doc: Document): serializedNode | false {
|
|||||||
const parentTagName =
|
const parentTagName =
|
||||||
n.parentNode && (n.parentNode as HTMLElement).tagName;
|
n.parentNode && (n.parentNode as HTMLElement).tagName;
|
||||||
let textContent = (n as Text).textContent;
|
let textContent = (n as Text).textContent;
|
||||||
|
const isStyle = parentTagName === 'STYLE' ? true : undefined;
|
||||||
|
if (isStyle && textContent) {
|
||||||
|
textContent = absoluteToStylesheet(textContent, location.href);
|
||||||
|
}
|
||||||
if (parentTagName === 'SCRIPT') {
|
if (parentTagName === 'SCRIPT') {
|
||||||
textContent = 'SCRIPT_PLACEHOLDER';
|
textContent = 'SCRIPT_PLACEHOLDER';
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
type: NodeType.Text,
|
type: NodeType.Text,
|
||||||
textContent: textContent || '',
|
textContent: textContent || '',
|
||||||
isStyle: parentTagName === 'STYLE' ? true : undefined,
|
isStyle,
|
||||||
};
|
};
|
||||||
case n.CDATA_SECTION_NODE:
|
case n.CDATA_SECTION_NODE:
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user