Revert "small changes"

This reverts commit 3a85734b7f.
This commit is contained in:
Percs 2024-07-12 16:09:48 -05:00
parent 759ebd747e
commit 35b1d08bfb
21 changed files with 196 additions and 257 deletions

View file

@ -1,23 +1,21 @@
import { rewriteCss } from "../bundle";
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"];
CSSStyleDeclaration.prototype.setProperty = new Proxy(CSSStyleDeclaration.prototype.setProperty, {
apply(target, thisArg, argArray) {
if (cssProperties.includes(argArray[0])) argArray[1] = rewriteCss(argArray[1]);
return Reflect.apply(target, thisArg, argArray);
},
apply(target, thisArg, argArray) {
if (cssProperties.includes(argArray[0])) argArray[1] = self.__scramjet$bundle.rewriters.rewriteCss(argArray[1]);
return Reflect.apply(target, thisArg, argArray);
},
});
jsProperties.forEach((prop) => {
const propDescriptor = Object.getOwnPropertyDescriptor(CSSStyleDeclaration.prototype, prop);
const propDescriptor = Object.getOwnPropertyDescriptor(CSSStyleDeclaration.prototype, prop);
Object.defineProperty(CSSStyleDeclaration.prototype, prop, {
set(v) {
propDescriptor.set.call(this, rewriteCss(v));
},
})
Object.defineProperty(CSSStyleDeclaration.prototype, prop, {
set(v) {
propDescriptor.set.call(this, self.__scramjet$bundle.rewriters.rewriteCss(v));
},
})
});