fix absolute to doc

This commit is contained in:
Yanzhen Yu
2026-04-01 12:00:00 +08:00
parent 2ced819b40
commit 08bee23494

View File

@@ -67,11 +67,7 @@ export function absoluteToStylesheet(cssText: string, href: string): string {
}); });
} }
const RELATIVE_PATH = /^(\.\.|\.|)\//;
function absoluteToDoc(doc: Document, attributeValue: string): string { function absoluteToDoc(doc: Document, attributeValue: string): string {
if (!RELATIVE_PATH.test(attributeValue)) {
return attributeValue;
}
const a: HTMLAnchorElement = doc.createElement('a'); const a: HTMLAnchorElement = doc.createElement('a');
a.href = attributeValue; a.href = attributeValue;
return a.href; return a.href;