Skip to content

Commit

Permalink
Remove form event delegation flag (#19395)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Jul 17, 2020
1 parent a59f899 commit aec934a
Show file tree
Hide file tree
Showing 11 changed files with 6 additions and 31 deletions.
17 changes: 6 additions & 11 deletions packages/react-dom/src/__tests__/ReactDOMEventListener-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,10 @@ describe('ReactDOMEventListener', () => {
document.body.removeChild(container);
});

// This is a special case for submit and reset events as they are listened on
// at the element level and not the document.
// @see https://github.com/facebook/react/pull/13462
it('should (or not) receive submit events if native, interim DOM handler prevents it', () => {
// This tests an implementation detail that submit/reset events are listened to
// at the document level, which is necessary for event replaying to work.
// They bubble in all modern browsers.
it('should not receive submit events if native, interim DOM handler prevents it', () => {
const container = document.createElement('div');
document.body.appendChild(container);

Expand Down Expand Up @@ -316,13 +316,8 @@ describe('ReactDOMEventListener', () => {
}),
);

if (gate(flags => flags.enableFormEventDelegation)) {
expect(handleSubmit).not.toHaveBeenCalled();
expect(handleReset).not.toHaveBeenCalled();
} else {
expect(handleSubmit).toHaveBeenCalled();
expect(handleReset).toHaveBeenCalled();
}
expect(handleSubmit).not.toHaveBeenCalled();
expect(handleReset).not.toHaveBeenCalled();
} finally {
document.body.removeChild(container);
}
Expand Down
8 changes: 0 additions & 8 deletions packages/react-dom/src/events/DOMModernPluginEventSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ import {
TOP_INVALID,
TOP_SCROLL,
TOP_CLOSE,
TOP_RESET,
TOP_SUBMIT,
TOP_CAN_PLAY,
TOP_CAN_PLAY_THROUGH,
TOP_DURATION_CHANGE,
Expand Down Expand Up @@ -83,7 +81,6 @@ import getListener from './getListener';
import {passiveBrowserEventsSupported} from './checkPassiveEvents';

import {
enableFormEventDelegation,
enableLegacyFBSupport,
enableCreateEventHandleAPI,
enableScopeAPI,
Expand Down Expand Up @@ -244,11 +241,6 @@ export const capturePhaseEvents: Set<DOMTopLevelEventType> = new Set([
TOP_WAITING,
]);

if (!enableFormEventDelegation) {
capturePhaseEvents.add(TOP_SUBMIT);
capturePhaseEvents.add(TOP_RESET);
}

if (enableCreateEventHandleAPI) {
capturePhaseEvents.add(TOP_AFTER_BLUR);
}
Expand Down
3 changes: 0 additions & 3 deletions packages/shared/ReactFeatureFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,3 @@ export const deferRenderPhaseUpdateToNextBatch = true;

// Replacement for runWithPriority in React internals.
export const decoupleUpdatePriorityFromScheduler = false;

// Enables delegation for submit and reset events.
export const enableFormEventDelegation = false;
1 change: 0 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.native-fb.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export const warnAboutSpreadingKeyToJSX = false;
export const enableComponentStackLocations = false;
export const enableLegacyFBSupport = false;
export const enableFilterEmptyStringAttributesDOM = false;
export const enableFormEventDelegation = false;

export const enableNewReconciler = false;
export const deferRenderPhaseUpdateToNextBatch = true;
Expand Down
1 change: 0 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.native-oss.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export const warnAboutSpreadingKeyToJSX = false;
export const enableComponentStackLocations = false;
export const enableLegacyFBSupport = false;
export const enableFilterEmptyStringAttributesDOM = false;
export const enableFormEventDelegation = false;

export const enableNewReconciler = false;
export const deferRenderPhaseUpdateToNextBatch = true;
Expand Down
1 change: 0 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.test-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export const warnAboutSpreadingKeyToJSX = false;
export const enableComponentStackLocations = true;
export const enableLegacyFBSupport = false;
export const enableFilterEmptyStringAttributesDOM = false;
export const enableFormEventDelegation = false;

export const enableNewReconciler = false;
export const deferRenderPhaseUpdateToNextBatch = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export const warnAboutSpreadingKeyToJSX = false;
export const enableComponentStackLocations = true;
export const enableLegacyFBSupport = false;
export const enableFilterEmptyStringAttributesDOM = false;
export const enableFormEventDelegation = false;

export const enableNewReconciler = false;
export const deferRenderPhaseUpdateToNextBatch = true;
Expand Down
1 change: 0 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.testing.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export const warnAboutSpreadingKeyToJSX = false;
export const enableComponentStackLocations = true;
export const enableLegacyFBSupport = false;
export const enableFilterEmptyStringAttributesDOM = false;
export const enableFormEventDelegation = false;

export const enableNewReconciler = false;
export const deferRenderPhaseUpdateToNextBatch = true;
Expand Down
1 change: 0 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.testing.www.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export const warnAboutSpreadingKeyToJSX = false;
export const enableComponentStackLocations = true;
export const enableLegacyFBSupport = !__EXPERIMENTAL__;
export const enableFilterEmptyStringAttributesDOM = false;
export const enableFormEventDelegation = false;

export const enableNewReconciler = false;
export const deferRenderPhaseUpdateToNextBatch = true;
Expand Down
2 changes: 0 additions & 2 deletions packages/shared/forks/ReactFeatureFlags.www-dynamic.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,3 @@ export const replayFailedUnitOfWorkWithInvokeGuardedCallback = __DEV__;
// to __VARIANT__.
export const enableTrustedTypesIntegration = false;
export const disableSchedulerTimeoutBasedOnReactExpirationTime = false;

export const enableFormEventDelegation = __VARIANT__;
1 change: 0 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.www.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export const {
decoupleUpdatePriorityFromScheduler,
enableDebugTracing,
enableSchedulingProfiler,
enableFormEventDelegation,
} = dynamicFeatureFlags;

// On WWW, __EXPERIMENTAL__ is used for a new modern build.
Expand Down

0 comments on commit aec934a

Please sign in to comment.