|
@@ -72,9 +72,12 @@ this.SingleFile = (() => {
|
|
|
class DOM {
|
|
class DOM {
|
|
|
static create(pageContent, baseURI) {
|
|
static create(pageContent, baseURI) {
|
|
|
const doc = (new DOMParser()).parseFromString(pageContent, "text/html");
|
|
const doc = (new DOMParser()).parseFromString(pageContent, "text/html");
|
|
|
- const baseElement = doc.createElement("base");
|
|
|
|
|
- baseElement.href = baseURI;
|
|
|
|
|
- doc.head.insertBefore(baseElement, doc.head.firstChild);
|
|
|
|
|
|
|
+ let baseElement = doc.querySelector("base");
|
|
|
|
|
+ if (!baseElement) {
|
|
|
|
|
+ baseElement = doc.createElement("base");
|
|
|
|
|
+ baseElement.href = baseURI;
|
|
|
|
|
+ doc.head.insertBefore(baseElement, doc.head.firstChild);
|
|
|
|
|
+ }
|
|
|
return {
|
|
return {
|
|
|
DOMParser,
|
|
DOMParser,
|
|
|
getComputedStyle,
|
|
getComputedStyle,
|