-
Notifications
You must be signed in to change notification settings - Fork 33
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
Set coalesced events isTrusted flag to false #187
Comments
If UA has created the event, it should have isTrusted=true. Events created explicitly from JS have isTrusted=false. (element.click() is a special case for these rules) |
It creates special rules around dispatch. For example if you redispatch an trusted event then you need to walk all the coalesced events and update them to match isTrusted of the parent to be false no? I wondered if we could avoid this by just saying all the fields on the base Event aren't really useful. |
of the parent? Why would you need to update anything? The coalesced events are there without any dispatching. One could also just put some expando js property to an event with some trusted events and those wouldn't get updated. |
Because then you'd be in a situation whereby And you can't really determine the case whereby a person held onto coalesced events and re-dispatched them at you. isTrusted communicates whether the UA really dispatched this event or not. And if we are populating the event it should really convey the correct meaning. I'd honestly wonder if we didn't reuse the Events object and just had a dictionary of values for the coalesced events then we don't get into all this mess of saying what fields are applicable and aren't. For example why would someone think that offsetX/offsetY wouldn't work; well you'd have to read the spec that there is no target set for the event and those properties are dependent on having a target. |
yeah, dictionaries might make this simpler. Trying to recall why events are used... |
Iif web app wants to handle those coalesced events after all, it might be simpler to reuse PointerEvents. But then, if values in the events are bogus... |
On the converse of my point... I could do something like: var a = event.getCoalescedEvent(0); It is odd that the isTrusted changes even though you didn't do something to the child object itself. That is why I had a discussion with Navid about whether we just say isTrusted is bogus like the rest of the fields we said were bogus, target, relatedTarget, bubbles, stopPropogation, etc... But to me this feels like a wart we are adding to the web platform possibly. I know we did think that if someone wanted to change their code from using the "unioned" events to using the coalescedEvents then they'd just add a for loop and that was the thought around using Events but I don't know if that makes a whole lot of sense anymore. |
I don't have a strong opinion on the bigger picture question of whether it's better to use IMHO it's not really worth re-litigating that decision now. The IMHO we don't get much real benefit in practice by clearing the |
If you are trying to do this at object creation time you can't (inheriting from your parent). Because isTrusted is always initialized to true according to the spec event for; isTrusted is supposed to be true until they are dispatched (https://dom.spec.whatwg.org/#interface-eventtarget). Whereas I was just saying lets default it to false always and forget about it. So really we are debating whether the coalesced events should have isTrusted be true or false. I guess the DOM spec always have Events default to true so I'm fine matching that (but I've never really agreed with that). |
I see. Yeah either of those options is fine with me. |
@dtapuska @smaug---- @RByers
I was wondering if it is alright to leave the isTrusted flag to be false instead of setting it from the original event. I believe since these coalesced events are not the events to be fired or maybe handled by themselves having the isTrusted bit doesn't convey much of a meaning.
The text was updated successfully, but these errors were encountered: