Closed rowan-m closed 4 weeks ago
Good question. I'll check some of the ramifications and circle back to this.
There is a slight discrepancy here between MDN and the spec.
MDN (non-authoritative):
The isTrusted read-only property of the Event interface is a boolean value that is true when the event was generated by a user action, and false when the event was created or modified by a script or dispatched via EventTarget.dispatchEvent().
Spec (authoritative):
Returns true if event was dispatched by the user agent, and false otherwise.
I'd say that these events are dispatched by the user agent; that the user agent does so in response to a script running in another tab does not seem to me to materially change the case. So I'd argue that isTrusted
should be true
here. Wdyt?
Returns true if event was dispatched by the user agent, and false otherwise.
I'd say that these events are dispatched by the user agent; that the user agent does so in response to a script running in another tab does not seem to me to materially change the case. So I'd argue that
isTrusted
should betrue
here. Wdyt?
Under this definition and interpretation, is it possible for isTrusted to ever be false
? How can an event not be dispatched by the UA?
Found this note in the spec, which coincides with the MDN explanation (at least the second part):
isTrusted is a convenience that indicates whether an event is dispatched by the user agent (as opposed to using dispatchEvent()). The sole legacy exception is click(), which causes the user agent to dispatch an event whose isTrusted attribute is initialized to false.
Open question: my initial assumption is
false
as this is modified by a script, but I didn't see it explicitly stated.