Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event API: remove isTargetDirectlyWithinEventComponent #15546

Merged
merged 1 commit into from
Apr 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions packages/react-dom/src/events/DOMEventResponderSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,22 +176,6 @@ const eventResponderContext: ReactResponderContext = {
}
return false;
},
isTargetDirectlyWithinEventComponent(target: Element | Document): boolean {
validateResponderContext();
if (target != null) {
let fiber = getClosestInstanceFromNode(target);
while (fiber !== null) {
if (fiber.stateNode === currentInstance) {
return true;
}
if (fiber.tag === EventComponent) {
return false;
}
fiber = fiber.return;
}
}
return false;
},
isTargetWithinEventResponderScope(target: Element | Document): boolean {
validateResponderContext();
const responder = ((currentInstance: any): ReactEventComponentInstance)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ describe('DOMEventResponderSystem', () => {
]);
});

it('isTargetDirectlyWithinEventComponent works', () => {
it('isTargetWithinEventResponderScope works', () => {
const buttonRef = React.createRef();
const divRef = React.createRef();
const log = [];
Expand All @@ -720,7 +720,7 @@ describe('DOMEventResponderSystem', () => {
undefined,
undefined,
(event, context) => {
const isWithin = context.isTargetDirectlyWithinEventComponent(
const isWithin = context.isTargetWithinEventResponderScope(
event.nativeEvent.relatedTarget,
);
log.push(isWithin);
Expand Down
4 changes: 0 additions & 4 deletions packages/react-events/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,6 @@ Returns `true` if the instance has taken ownership of the responder.

Returns `true` if the global coordinates lie within the TouchHitTarget.

### isTargetDirectlyWithinEventComponent(target: Element): boolean

Returns `true` is the target element is within the direct subtree of the Event Component instance, i.e., the target is not nested within an Event Component instance that is a descendant of the current instance.

### isTargetWithinElement(target: Element, element: Element): boolean

Returns `true` if `target` is a child of `element`.
Expand Down
4 changes: 2 additions & 2 deletions packages/react-events/src/Hover.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function dispatchHoverStartEvents(
if (event !== null) {
const {nativeEvent} = event;
if (
context.isTargetDirectlyWithinEventComponent(
context.isTargetWithinEventResponderScope(
(nativeEvent: any).relatedTarget,
)
) {
Expand Down Expand Up @@ -157,7 +157,7 @@ function dispatchHoverEndEvents(
if (event !== null) {
const {nativeEvent} = event;
if (
context.isTargetDirectlyWithinEventComponent(
context.isTargetWithinEventResponderScope(
(nativeEvent: any).relatedTarget,
)
) {
Expand Down
1 change: 0 additions & 1 deletion packages/shared/ReactTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ export type ReactResponderContext = {
parentTarget: Element | Document,
) => boolean,
isTargetWithinEventComponent: (Element | Document) => boolean,
isTargetDirectlyWithinEventComponent: (Element | Document) => boolean,
isTargetWithinEventResponderScope: (Element | Document) => boolean,
isPositionWithinTouchHitTarget: (x: number, y: number) => boolean,
addRootEventTypes: (
Expand Down