mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-19 12:08:57 +00:00
Switch to .mjs for ES Modules. Fixes #88.
This commit is contained in:
26
src/lib/fix-pmc.mjs
Normal file
26
src/lib/fix-pmc.mjs
Normal file
@@ -0,0 +1,26 @@
|
||||
import { options } from 'preact';
|
||||
|
||||
const classNameDescriptor = {
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
get () {
|
||||
return this.class;
|
||||
},
|
||||
set (value) {
|
||||
this.class = value;
|
||||
}
|
||||
};
|
||||
|
||||
const old = options.vnode;
|
||||
options.vnode = vnode => {
|
||||
const a = vnode.attributes;
|
||||
if (a != null) {
|
||||
if ('className' in a) {
|
||||
a.class = a.className;
|
||||
}
|
||||
if ('class' in a) {
|
||||
Object.defineProperty(a, 'className', classNameDescriptor);
|
||||
}
|
||||
}
|
||||
if (old != null) old(vnode);
|
||||
};
|
||||
Reference in New Issue
Block a user