mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-13 06:20:02 -04:00
fix: baseURI
This commit is contained in:
parent
daa2e3452e
commit
cbd3fcd718
1 changed files with 3 additions and 1 deletions
|
@ -106,7 +106,9 @@ export default function (client: ScramjetClient, self: typeof window) {
|
||||||
client.Trap("Node.prototype.baseURI", {
|
client.Trap("Node.prototype.baseURI", {
|
||||||
get(ctx) {
|
get(ctx) {
|
||||||
const node = ctx.this as Node;
|
const node = ctx.this as Node;
|
||||||
const base = node.ownerDocument.querySelector("base");
|
let base = node.ownerDocument?.querySelector("base");
|
||||||
|
if (node instanceof Document) base = node.querySelector("base");
|
||||||
|
|
||||||
if (base) {
|
if (base) {
|
||||||
return new URL(base.href, client.url.origin).href;
|
return new URL(base.href, client.url.origin).href;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue