@bleedingdev/tanstack-redact 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -21,10 +21,12 @@ function createSyntheticEvent(native) {
|
|
|
21
21
|
persist() {
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
|
-
for (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
for (let o = native; o; o = Object.getPrototypeOf(o)) {
|
|
25
|
+
for (const key of Object.getOwnPropertyNames(o)) {
|
|
26
|
+
if (!(key in event)) {
|
|
27
|
+
const value = native[key];
|
|
28
|
+
event[key] = isFunction(value) ? value.bind(native) : value;
|
|
29
|
+
}
|
|
28
30
|
}
|
|
29
31
|
}
|
|
30
32
|
return event;
|
package/package.json
CHANGED
|
@@ -12,10 +12,15 @@ export function createSyntheticEvent(native: Event) {
|
|
|
12
12
|
stopImmediatePropagation() { stopped = true; native.stopImmediatePropagation() },
|
|
13
13
|
persist() {},
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
// Walk the prototype chain instead of `for…in`: DOM implementations such as
|
|
16
|
+
// happy-dom define `type`, `target` and other Event fields as non-enumerable
|
|
17
|
+
// accessors. Object.prototype names are already `in event`, so they are skipped.
|
|
18
|
+
for (let o: object | null = native; o; o = Object.getPrototypeOf(o)) {
|
|
19
|
+
for (const key of Object.getOwnPropertyNames(o)) {
|
|
20
|
+
if (!(key in event)) {
|
|
21
|
+
const value = (native as any)[key]
|
|
22
|
+
event[key] = isFunction(value) ? value.bind(native) : value
|
|
23
|
+
}
|
|
19
24
|
}
|
|
20
25
|
}
|
|
21
26
|
return event
|