-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Editorial: major cleanup around firing events #1886
Conversation
There’s no need to state defaults again as that only leads to confusion when they are not explicitly stated.
This is part of #1713 FYI |
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.
Additional cleanups to do:
- #downloading-or-updating-an-application-cache:concept-event-fire
- #downloading-or-updating-an-application-cache:concept-event-fire-2
- #runtime-script-errors-2:concept-event-fire
- #the-storage-event:concept-event-fire
- #the-end:concept-event-fire
Following the dfn popup for dispatch also has many of these cases, where it uses the terminology "does not bubble and is not cancelable" or similar when setting up the event and then dispatching it in a subsequent step. (Many of these cases could probably become "fire" instead of "dispatch" by collapsing some steps... I don't understand why they're separate in most cases. Probably cargo-culting. If you collapse the steps and use "fire", you also can get rid of the "trusted" concept, since trusted is the default for firing.)
- #fire-a-focus-event
- #the-dragevent-interface:concept-event-dispatch
- #unloading-documents:concept-event-dispatch
- #runtime-script-errors:concept-event-dispatch
- #unhandled-promise-rejections:concept-event-dispatch
- #the-hostpromiserejectiontracker-implementation:concept-event-dispatch
- #event-firing:concept-event-dispatch
- #event-firing:concept-event-dispatch-2
- #event-stream-interpretation:concept-event-dispatch
- #feedback-from-the-protocol:concept-event-dispatch
- #feedback-from-the-protocol:concept-event-dispatch-2
- #posting-messages:concept-event-dispatch
- #message-ports:concept-event-dispatch
- #broadcasting-to-other-browsing-contexts:concept-event-dispatch
- #worker-processing-model:concept-event-dispatch
- #shared-workers-and-the-sharedworker-interface:concept-event-dispatch
In general I think you'll want to Ctrl+F for "does not bubble" and "is not cancelable".
<code>MouseEvent</code> interface, at the element for which the menu was requested. The context | ||
information of the event must be initialized to the same values as the last | ||
<dd><p>The user agent must <span data-x="concept-event-fire">fire</span> an event with the name | ||
<code data-x="event-contextmenu">contextmenu</code>, that bubbles and is cancelable, and that |
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.
This should use the new style for bubbles and cancelable, I think
<code data-x="dom-PopStateEvent-state">state</code> attribute initialized to the value of <var>state</var>. This event must bubble but not be cancelable and has no default | ||
action.</p></li> | ||
<code data-x="dom-Event-bubbles">bubbles</code> attribute initialized to true and the <code | ||
data-x="dom-PopStateEvent-state">state</code> attribute initialized to the value of |
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.
"initialized to state" would be a bit nicer while you're here
@@ -83197,8 +83187,7 @@ State: <OUTPUT NAME=I>1</OUTPUT> <INPUT VALUE="Increment" TYPE=BUTTON O | |||
|
|||
</li> | |||
|
|||
<li><p><span data-x="concept-event-fire">Fire</span> a <span | |||
data-x="concept-events-trusted">trusted</span> event with the name <code | |||
<li><p><span data-x="concept-event-fire">Fire</span> an event with the name <code | |||
data-x="event-pageshow">pageshow</code> at the <code>Window</code> object of that | |||
<code>Document</code>, with <i | |||
data-x="concept-event-target-override">target override</i> set to the <code>Document</code> |
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.
This one has "This event must not bubble, must not be cancelable, and has no default action." which should be removed.
So I mainly removed trusted and then did some cleanup alongside. I guess we could turn this into something bigger, but then I should probably first redesign "fire an event" on the DOM side and make all that work too. |
Hmm OK. I think it'd be nice to land more at once but if it'd be helpful to work incrementally then I think just addressing the line comments (without doing the additional cleanups on the IDs I listed) would be fine. Maybe with a commit message that notes this is just an initial pass and there are many other call sites that need updating. |
I'm happy to make this bigger. I already created a PR for DOM to redesign "fire an event": whatwg/dom#344. Would be best to review and land that first, then work on this. |
Document object's Window object or Document object's relevant global object? Kept the former for now, should maybe be a separate change for all instances (not that many). (I also found one instance of the latter not being correctly linked. Apparently wattsi does start complaining, but only after you have two instances of data-x-less |
FWIW, anything in the AppCache section I rather not touch until we decide what to do there. It seems better for that to either be removed, or be cleaned up altogether and integrated with Fetch if we decide to keep it. |
I'd rather clean up the appcache ones as well. It's a mechanical transformation with no normative impact. We don't gain anything by making it inconsistent with the rest of the spec. |
(we probably need to review these for isTrusted usage, some might be wrong, as a follow up)
This is ready for review now. I tried filing follow up issues whenever I saw something bogus. |
Missed:
Typos:
Other:
Commit message should mention the follow-ups if possible. |
Commit message prep:
|
This should use dispatch actually, since the event is already created, we're just rerouting it. This is another thing that is monkey patching the non-existing UI events specification. |
I plan on not doing this given that we have a volunteer. If that doesn't pan out I'll make it happen. |
This is #1900. |
"is canceled" and "not canceled" don't give many results, some are in notes. I will clean it up, but not those I found inside the "Activation" section as that will largely disappear with #1394. |
This actually looks complicated, since it does steps after dispatch. I wonder if the text as written is even correct. I'm not planning on fixing this here. |
So we might want to open an issue for the DND processing model (or the larger lack of user interaction specification), but other than that I once again think I'm done. |
@@ -89705,6 +89705,9 @@ interface <dfn>DocumentAndElementEventHandlers</dfn> { | |||
<li><p>Initialize <var>event</var>'s <code data-x="dom-Event-bubbles">bubbles</code> and <code | |||
data-x="dom-Event-cancelable">cancelable</code> attributes to true. | |||
|
|||
<li><p>Initialize <var>event</var>'s <code data-x="dom-Event-isTrusted">isTrusted</code> | |||
attribute to true (unless otherwise stated). |
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.
Missing closing tags
There’s no need to state defaults again as that only leads to confusion
when they are not explicitly stated.