fix: baseURI

This commit is contained in:
Percs 2024-12-20 23:42:33 -06:00
parent daa2e3452e
commit cbd3fcd718

View file

@ -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;
} }