dillon1000/react

Commit

Simplify Event Core

Summary:
This makes a few changes to React Core, most notably `ReactEventEmitter` and `ReactEventTopLevelCallback`.

 - Changed `ReactEventEmitter` to use `EventListener` (instead of `NormalizedEventListener`).
 - Deleted `NormalizedEventListener` (which was previously broken).
 - Created `getEventTarget` which is used to get a normalized `target` from a native event.
 - Changed `ReactEventTopLevelCallback` to use `getEventTarget`.
 - Renamed `abstractEventType` to `reactEventType` in `AbstractEvent`.
 - Reanmed `abstractTargetID` to `reactTargetID` in `AbstractEvent`.
 - Removed `originatingTopLevelEventType` from `AbstractEvent` (unused and violates encapsulation).
 - Removed `nativeEvent.target === window` check when refreshing authoritative scroll values (unnecessary).

This actually fixes React because `NormalizedEventListener` does not currently do what it promises to do (which is normalizing `target` on the native event). The `target` event is read-only on native events.

This also revises documentation and adds `@typechecks` to a few modules.

NOTE: Most importantly, this sets the stage for replacing `AbstractEvent` with `ReactEvent` and subclasses, piecemeal.
Browse files
Changed paths15 files
First-parent comparison
M src/core/ReactEventEmitter.js ModifiedM src/core/ReactEventTopLevelCallback.js ModifiedM src/core/ReactInstanceHandles.js ModifiedM src/dom/getDOMNodeID.js ModifiedA src/dom/getEventTarget.js AddedM src/event/AbstractEvent.js ModifiedM src/event/EventPluginHub.js ModifiedM src/event/EventPropagators.js ModifiedD src/event/NormalizedEventListener.js DeletedM src/eventPlugins/AnalyticsEventPluginFactory.js ModifiedM src/eventPlugins/EnterLeaveEventPlugin.js ModifiedM src/eventPlugins/ResponderEventPlugin.js ModifiedM src/eventPlugins/SimpleEventPlugin.js ModifiedM src/eventPlugins/TapEventPlugin.js ModifiedM src/eventPlugins/__tests__/ResponderEventPlugin-test.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…