Skip to content

[flags] Clean up enableTrustedTypesIntegration#616

Open
everettbu wants to merge 1 commit into
mainfrom
rh/cleanup-trusted-types
Open

[flags] Clean up enableTrustedTypesIntegration#616
everettbu wants to merge 1 commit into
mainfrom
rh/cleanup-trusted-types

Conversation

@everettbu

Copy link
Copy Markdown

Mirror of facebook/react#35905
Original author: rickhanlonii


This is on everywhere so we can reap the code

@everettbu everettbu added CLA Signed React Core Team Opened by a member of the React Core Team labels Feb 25, 2026
@greptile-apps

greptile-apps Bot commented Feb 25, 2026

Copy link
Copy Markdown

Greptile Summary

Removed the enableTrustedTypesIntegration feature flag which was enabled everywhere. The cleanup eliminates conditional logic across DOM property operations, form actions, and test files, keeping only the enabled behavior where TrustedType objects are passed directly to DOM APIs without stringification.

Key Changes:

  • Removed flag declaration from all ReactFeatureFlags files (7 files)
  • Simplified setAttribute and setAttributeNS calls to pass values directly without conditional coercion
  • Updated sanitizeURL calls to accept values as-is for href, formAction, and xlink:href attributes
  • Removed gate conditions in tests so TrustedType behavior is always expected
  • Script tag dev warning now always displays (was conditional on flag)

Impact:
This is a standard feature flag cleanup with no behavioral changes since the flag was already enabled in all environments. The changes reduce code complexity and maintenance burden.

Confidence Score: 5/5

  • Safe to merge - standard feature flag cleanup with no behavioral changes
  • Flag was already enabled everywhere, changes are mechanical and consistent, grep confirms no remaining references, all test updates align with keeping the enabled behavior
  • No files require special attention

Important Files Changed

Filename Overview
packages/react-dom-bindings/src/client/DOMPropertyOperations.js Removed flag import and simplified setAttribute calls to pass values directly without conditional stringification
packages/react-dom-bindings/src/client/ReactDOMComponent.js Removed flag import and simplified sanitizeURL calls across multiple prop types (href, formAction, xlink:href)
packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js Removed flag import and unconditionally show script tag warning in dev mode
packages/react-dom-bindings/src/events/plugins/FormActionEventPlugin.js Removed flag import and simplified coerceFormActionProp to pass values directly to sanitizeURL
packages/react-dom/src/client/tests/trustedTypes-test.internal.js Removed all gate conditions so tests always expect TrustedType objects to pass through without stringification
packages/shared/ReactFeatureFlags.js Removed enableTrustedTypesIntegration flag declaration

Last reviewed commit: 870f08e

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

16 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps

greptile-apps Bot commented Feb 25, 2026

Copy link
Copy Markdown
Additional Comments (1)

packages/react-dom/src/__tests__/ReactDOMForm-test.js
Stale comment after flag removal
This comment says "unless trusted types are enabled" but now that enableTrustedTypesIntegration has been removed (always enabled), the qualification no longer applies. Values are now never toString-ed in this path. Consider updating the comment to reflect the new behavior.

    // Everything else is passed through without toString coercion.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/react-dom/src/__tests__/ReactDOMForm-test.js
Line: 2331

Comment:
**Stale comment after flag removal**
This comment says "unless trusted types are enabled" but now that `enableTrustedTypesIntegration` has been removed (always enabled), the qualification no longer applies. Values are now never toString-ed in this path. Consider updating the comment to reflect the new behavior.

```suggestion
    // Everything else is passed through without toString coercion.
```

How can I resolve this? If you propose a fix, please make it concise.

@everettbu everettbu changed the title [flags] Clean up enableTrustedTypes [flags] Clean up enableTrustedTypesIntegration Feb 26, 2026
@everettbu
everettbu force-pushed the rh/cleanup-trusted-types branch from 0a3eaf4 to 870f08e Compare February 27, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants