mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-14 06:50:01 -04:00
fix: double api proxying
This commit is contained in:
parent
f50e2e67da
commit
c4f03f5ea7
1 changed files with 5 additions and 15 deletions
|
@ -16,18 +16,16 @@ const cssProperties = [
|
||||||
export default function (client: ScramjetClient) {
|
export default function (client: ScramjetClient) {
|
||||||
client.Proxy("CSSStyleDeclaration.prototype.setProperty", {
|
client.Proxy("CSSStyleDeclaration.prototype.setProperty", {
|
||||||
apply(ctx) {
|
apply(ctx) {
|
||||||
if (cssProperties.includes(ctx.args[0]))
|
if (!ctx.args[1]) return;
|
||||||
ctx.args[1] = rewriteCss(ctx.args[1], client.meta);
|
ctx.args[1] = rewriteCss(ctx.args[1], client.meta);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
client.Proxy("CSSStyleDeclaration.prototype.getPropertyValue", {
|
client.Proxy("CSSStyleDeclaration.prototype.getPropertyValue", {
|
||||||
apply(ctx) {
|
apply(ctx) {
|
||||||
if (cssProperties.includes(ctx.args[0])) {
|
const v = ctx.call();
|
||||||
const realProperty = ctx.call();
|
if (!v) return v;
|
||||||
|
ctx.return(unrewriteCss(v));
|
||||||
return ctx.return(unrewriteCss(realProperty));
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -78,12 +76,4 @@ export default function (client: ScramjetClient) {
|
||||||
ctx.set(v);
|
ctx.set(v);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
client.Proxy("CSSStyleDeclaration.prototype.getPropertyValue", {
|
|
||||||
apply(ctx) {
|
|
||||||
const v = ctx.call();
|
|
||||||
if (!v) return v;
|
|
||||||
ctx.return(unrewriteCss(v));
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue