bug fixes

This commit is contained in:
Avad3 2024-07-14 14:33:57 -04:00
parent 20caf32b5b
commit b293eea0bd
2 changed files with 9 additions and 15 deletions

View file

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

View file

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