fix absolute to doc

This commit is contained in:
Yanzhen Yu
2018-11-23 23:36:19 +08:00
parent c856fb5ea9
commit 66e8d4318c

View File

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