mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-14 15:00:01 -04:00
fix janky base stuff
This commit is contained in:
parent
09f4863e86
commit
d3a86ab133
1 changed files with 7 additions and 11 deletions
|
@ -111,23 +111,19 @@ export class ScramjetClient {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let baseurl: URL;
|
|
||||||
if (iswindow) {
|
|
||||||
// setup base url
|
|
||||||
// base url can only be updated at document load time and it will affect all urls resolved by encodeurl/rewriteurl
|
|
||||||
const base = this.global.document.querySelector("base");
|
|
||||||
if (base) {
|
|
||||||
baseurl = new URL(decodeUrl(base.href));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const client = this;
|
const client = this;
|
||||||
this.meta = {
|
this.meta = {
|
||||||
get origin() {
|
get origin() {
|
||||||
return client.url;
|
return client.url;
|
||||||
},
|
},
|
||||||
get base() {
|
get base() {
|
||||||
return baseurl || client.url;
|
if (iswindow) {
|
||||||
|
const base = client.global.document.querySelector("base");
|
||||||
|
if (base) {
|
||||||
|
return new URL(base.getAttribute(`href`), client.url.origin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return client.url;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue