Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Suppress non-target boundary events on capture #195

Closed
wants to merge 3 commits into from
Closed

Suppress non-target boundary events on capture #195

wants to merge 3 commits into from

Conversation

bethge
Copy link
Contributor

@bethge bethge commented Jun 11, 2015

This should suppress over, out, enter and leave through omission of a response value in getTarget().

This focuses on the situation described in the beginning of #177.

I would propose tracking issues such as what happens after releasing a captured pointer on a different element and rewriting the event firing process in a new issue (to have at least a little closure 😃 ).

@stuartpb
Copy link
Contributor

@bethge Yeah, I'm working on rewriting some of the event firing so that pointer capture will work for multiple pointers (right now the polyfill is only tracking one pointer capture which falls apart for multi-touch).

That said, I don't think any of this is incompatible with what I'm writing.

@bethge
Copy link
Contributor Author

bethge commented Jun 14, 2015

I hope the w3c test is in the right place. I feel like testing it is a little nifty because there is no "original" target I can test against, to see whether the event was supposed to be fired.

I went with testing if the cursor is actually over the target that fires the pointerover event. Not sure if that would work for touch.

@stuartpb Ok great. The change is not too gargantuan 😉 .

}
},
suppressDuringCapture: function(inEvent) {
var suppress = [
Copy link
Contributor

Choose a reason for hiding this comment

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

Move this to a constant (like var CLONE_DEFAULTS above) and make it an object to improve lookup performance. Use "BOUNDARY_EVENTS" for the name.

@bethge bethge changed the title Fixes #177 Suppress non-target boundary events on capture Nov 21, 2015
suppressDuringCapture: function(inEvent) {
var capture = this.captureInfo[inEvent.pointerId];
var isNonCaptureTarget = inEvent._target !== capture;
var needsSuppressing = BOUNDARY_EVENTS.indexOf(inEvent.type) > -1;
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this can be a hot path, I'd like to switch BOUNDARY_EVENTS to an object so we don't need to walk through the list for each event.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Turned BOUNDARY_EVENTS into an object: https://github.com/jquery/PEP/blob/89149e0595203a3425686f93100fbf3f3e759d1c/src/dispatcher.js#L88-L93 . Does it need a Object.create(null), for defensive reasons?

bethge added a commit that referenced this pull request Jan 7, 2016
bethge added a commit that referenced this pull request Jan 7, 2016
@bethge bethge closed this in 14b44f3 Jan 7, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants