Skip to content

Preserve null NodeList forEach context - #58243

Open
OskarEichler wants to merge 1 commit into
react:mainfrom
OskarEichler:codex/fix-nodelist-null-thisarg
Open

Preserve null NodeList forEach context#58243
OskarEichler wants to merge 1 commit into
react:mainfrom
OskarEichler:codex/fix-nodelist-null-thisarg

Conversation

@OskarEichler

Copy link
Copy Markdown
Contributor

Summary:

NodeList.forEach currently treats both null and undefined as the omitted-context fast path, so a strict callback receives undefined when the caller explicitly supplied null. Use the fast path only for undefined and cover the standards-compatible null receiver.

Fixes #58242.

Changelog:

[GENERAL] [FIXED] - Preserve an explicit null thisArg in NodeList.forEach callbacks.

Test Plan:

  • Exact upstream focused suite: 12 existing tests passed and the new null-context regression failed.
  • Fixed focused Fantom suite: 13/13 passed.
  • Fresh Flow check: 0 errors.
  • Targeted no-ignore ESLint, Prettier, and git diff --check passed.

Only the observably incorrect explicit-null context changes; omitted and undefined contexts are unchanged.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 30, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NodeList.forEach drops an explicit null callback context

1 participant