mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-13 22:40:01 -04:00
fix: node.getrootnode
This commit is contained in:
parent
ee85b48d33
commit
c2570c1d86
2 changed files with 14 additions and 2 deletions
|
@ -306,7 +306,6 @@ export default function (client: ScramjetClient, self: typeof window) {
|
|||
"Node.prototype.parentElement",
|
||||
"Node.prototype.previousSibling",
|
||||
"Node.prototype.nextSibling",
|
||||
"Node.prototype.getRootNode",
|
||||
],
|
||||
{
|
||||
get(ctx) {
|
||||
|
@ -321,6 +320,18 @@ export default function (client: ScramjetClient, self: typeof window) {
|
|||
}
|
||||
);
|
||||
|
||||
client.Proxy("Node.prototype.getRootNode", {
|
||||
apply(ctx) {
|
||||
const n = ctx.call() as Node;
|
||||
if (!(n instanceof Document)) return ctx.return(n);
|
||||
|
||||
const scram: ScramjetClient = n[SCRAMJETCLIENT];
|
||||
if (!scram) return ctx.return(n); // ??
|
||||
|
||||
return ctx.return(scram.documentProxy);
|
||||
},
|
||||
});
|
||||
|
||||
client.Proxy("DOMParser.prototype.parseFromString", {
|
||||
apply(ctx) {
|
||||
if (ctx.args[1] === "text/html") {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue