Commit 25c25b3
fix: Make
Summary:
By spec `EventTarget` should have 3 enumerable methods (`addEventListener`, `removeEventListener` and `dispatchEvent`)
<img width="458" height="250" alt="Screenshot 2026-06-17 at 12 50 15" src="https://github.com/user-attachments/assets/c78b19ef-34d8-4df1-9b7a-22117362a043" />
## Changelog:
[GENERAL] [CHANGED] - Make `EventTarget` methods enumerable by spec
Pull Request resolved: #57247
Test Plan:
Create aRN app and run code with/without commented code
```tsx
// Object.defineProperties(EventTarget.prototype, {
// addEventListener: { enumerable: true },
// removeEventListener: { enumerable: true },
// dispatchEvent: { enumerable: true },
// });
console.log('Start');
for (const key in new EventTarget()) {
console.log({ key });
}
console.log('End');
```
Reviewed By: andrewdacenko
Differential Revision: D108908236
Pulled By: Abbondanzo
fbshipit-source-id: 0dbe8f008e32f026b02d82f74c591bd59ed93849EventTarget methods enumerable (#57247)1 parent 0fc122c commit 25c25b3
2 files changed
Lines changed: 20 additions & 0 deletions
File tree
- packages/react-native/src/private/webapis/dom/events
- __tests__
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
261 | 268 | | |
262 | 269 | | |
263 | 270 | | |
| |||
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
57 | 70 | | |
58 | 71 | | |
59 | 72 | | |
| |||
0 commit comments