@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 (const key in native) {
25
- if (!(key in event)) {
26
- const value = native[key];
27
- event[key] = isFunction(value) ? value.bind(native) : value;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bleedingdev/tanstack-redact",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "An alternative runtime for React apps, with a smaller footprint and synchronous rendering.",
5
5
  "type": "module",
6
6
  "main": "./dist/react/index.js",
@@ -12,10 +12,15 @@ export function createSyntheticEvent(native: Event) {
12
12
  stopImmediatePropagation() { stopped = true; native.stopImmediatePropagation() },
13
13
  persist() {},
14
14
  }
15
- for (const key in native) {
16
- if (!(key in event)) {
17
- const value = (native as any)[key]
18
- event[key] = isFunction(value) ? value.bind(native) : value
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