mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-14 06:50:01 -04:00
bug fixes
This commit is contained in:
parent
20caf32b5b
commit
b293eea0bd
2 changed files with 9 additions and 15 deletions
|
@ -1,8 +1,7 @@
|
||||||
import { rewriteCss } from "./shared";
|
import { rewriteCss } from "./shared";
|
||||||
|
|
||||||
const cssProperties = ["background", "background-image", "mask", "mask-image", "list-style", "list-style-image", "border-image", "border-image-source", "cursor"];
|
const cssProperties = ["background", "background-image", "mask", "mask-image", "list-style", "list-style-image", "border-image", "border-image-source", "cursor"];
|
||||||
const jsProperties = ["background", "backgroundImage", "mask", "maskImage", "listStyle", "listStyleImage", "borderImage", "borderImageSource", "cursor"];
|
// const jsProperties = ["background", "backgroundImage", "mask", "maskImage", "listStyle", "listStyleImage", "borderImage", "borderImageSource", "cursor"];
|
||||||
|
|
||||||
|
|
||||||
CSSStyleDeclaration.prototype.setProperty = new Proxy(CSSStyleDeclaration.prototype.setProperty, {
|
CSSStyleDeclaration.prototype.setProperty = new Proxy(CSSStyleDeclaration.prototype.setProperty, {
|
||||||
apply(target, thisArg, argArray) {
|
apply(target, thisArg, argArray) {
|
||||||
|
@ -10,17 +9,4 @@ CSSStyleDeclaration.prototype.setProperty = new Proxy(CSSStyleDeclaration.protot
|
||||||
|
|
||||||
return Reflect.apply(target, thisArg, argArray);
|
return Reflect.apply(target, thisArg, argArray);
|
||||||
},
|
},
|
||||||
});
|
|
||||||
|
|
||||||
jsProperties.forEach((prop) => {
|
|
||||||
const propDescriptor = Object.getOwnPropertyDescriptor(CSSStyleDeclaration.prototype, prop);
|
|
||||||
|
|
||||||
Object.defineProperty(CSSStyleDeclaration.prototype, prop, {
|
|
||||||
get() {
|
|
||||||
return propDescriptor.get.call(this);
|
|
||||||
},
|
|
||||||
set(v) {
|
|
||||||
return propDescriptor.set.call(this, rewriteCss(v));
|
|
||||||
},
|
|
||||||
})
|
|
||||||
});
|
});
|
|
@ -9,6 +9,14 @@ export const windowProxy = new Proxy(window, {
|
||||||
return windowProxy;
|
return windowProxy;
|
||||||
} else if (propIsString && prop === "$scramjet") {
|
} else if (propIsString && prop === "$scramjet") {
|
||||||
return;
|
return;
|
||||||
|
} else if (propIsString && prop === "addEventListener") {
|
||||||
|
console.log("addEventListener getteetetetetet")
|
||||||
|
|
||||||
|
return new Proxy(window.addEventListener, {
|
||||||
|
apply(target1, thisArg, argArray) {
|
||||||
|
window.addEventListener(argArray[0], argArray[1]);
|
||||||
|
},
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return target[prop];
|
return target[prop];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue