-
Notifications
You must be signed in to change notification settings - Fork 160
Suppress non-target boundary events on capture #195
Conversation
@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. |
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 @stuartpb Ok great. The change is not too gargantuan 😉 . |
} | ||
}, | ||
suppressDuringCapture: function(inEvent) { | ||
var suppress = [ |
There was a problem hiding this comment.
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.
suppressDuringCapture: function(inEvent) { | ||
var capture = this.captureInfo[inEvent.pointerId]; | ||
var isNonCaptureTarget = inEvent._target !== capture; | ||
var needsSuppressing = BOUNDARY_EVENTS.indexOf(inEvent.type) > -1; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
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 😃 ).