w3c / webref

Machine-readable references of terms defined in web browser specifications
https://w3c.github.io/webref/
MIT License
290 stars 73 forks source link

Curate events data for publication as a package #630

Closed dontcallmedom closed 2 years ago

dontcallmedom commented 2 years ago

Following the addition to reffy in https://github.com/w3c/reffy/pull/952, webref now has a raw extract of events information as suggested in https://github.com/w3c/reffy/issues/772: https://github.com/w3c/webref/tree/main/ed/events

A goal should be to release that data through a new webref package (e.g. to help with https://github.com/openwebdocs/project/issues/61); before that we need to:

Based on discussion in https://github.com/w3c/reffy/issues/772#issuecomment-1122909270, I think we would want accurate data on event type, associated interface, interfaces that host the relevant event handler, and whether the event bubbles.

A strategy to achieve this would be:

I'll follow up with details about the first of these bits - which specs provide only partial extractable data and what our options might be to make them extractable.

dontcallmedom commented 2 years ago

Specs with partial data: (skipping those for which there is already a pending PR)

Missing information about the targets

list obtained via

for i in *.json ; do title=`jq '.|select(.events[]|.targets|not)|(" * [ ] ["  + .spec.title + "](" + .spec.url + ")")' $i` ; if [ -n "$title" ] ; then echo "$title"; jq '.events[]|select(.targets|not).type' $i ; fi ; done`

Missing information about event interface

list obtained via

for i in *.json ; do title=`jq -r '.|select(.events[]|.interface|not)|(" * [ ] ["  + .spec.title + "](" + .spec.url + ")")' $i|head -1` ; if [ -n "$title" ] ; then echo "$title"; jq '.events[]|select(.interface|not).type' $i ; fi ; done`
dontcallmedom commented 2 years ago

@foolip @tidoust when you get a chance, if you could review the list of specs that needs changing and what it might take to make their information extractable, it would be useful for me to know what additional background I should provide before we try & split the work of patching the specs.

foolip commented 2 years ago

@dontcallmedom I've reviewed the two lists and that looks sensible to me. One thought is that the information on target, bubbling, etc., will almost never change, so if we can just recognize that there is an event in some spec, it would be okay if we have to fill in some of the data by hand.

tidoust commented 2 years ago

That looks good although it's not obvious to me that patches would improve the specs on top of making them more easily machine readable (that's great by itself, but not necessarily a priority for spec editors). The specs I reviewed seem clear and quite readable already. Ideally:

  1. Patches would not be "add a summary table maintained by hand" but more "adjust prose so that we can create summary tables automatically". I don't really know how to do that ;)
  2. We would be able to detect issues related to events in specs. For instance, I bumped onto CSSOM View and noticed that scrollend just appears in the Events summary section, which claims it is non-normative (but then it does not have any informative class). There should be some normative part in the spec that fires the event (if there is, I missed it).

I also wonder about the notion of target for elements that bubble. Wouldn't it be more useful to capture the interfaces on which the event can specifically be fired on top of the interfaces on which the event can bubble? For instance, reset can only fire at a form elements but we'll report HTMLElement as target.

foolip commented 2 years ago

I also wonder about the notion of target for elements that bubble. Wouldn't it be more useful to capture the interfaces on which the event can specifically be fired on top of the interfaces on which the event can bubble? For instance, reset can only fire at a form elements but we'll report HTMLElement as target.

For this case, the target should be an HTMLFormElement. What the event target should be doesn't depend on whether the event bubbles. (Terminology: when event handlers for other targets on the event path are invoked, those are the event.currentTarget, the event.target stays the same.)

tidoust commented 2 years ago

For this case, the target should be an HTMLFormElement. What the event target should be doesn't depend on whether the event bubbles. (Terminology: when event handlers for other targets on the event path are invoked, those are the event.currentTarget, the event.target stays the same.)

That makes sense to me and shows that, on top of looking at the above list, the current extraction logic is not good enough yet (it takes for granted that the target of an xxx event is the interface with an onxxx attribute, hence HTMLElement instead of HTMLFormElement).

Other events with similar problems in the HTML spec include cancel, change, close, contextrestored, formdata, slotchange, submit, toggle, etc.

dontcallmedom commented 2 years ago

That looks good although it's not obvious to me that patches would improve the specs on top of making them more easily machine readable (that's great by itself, but not necessarily a priority for spec editors). The specs I reviewed seem clear and quite readable already.

The fact that several specs already use the pattern of summary table illustrates that these tables have proved useful; I personally find them much easier to read as a human than having to hunt for the event in an algorithm. With all that said, my proposal is that we submit patches that integrate these summary tables - if the editors of the relevant specs determine they're not useful or creates too much of a maintenance footgun, then we would fallback on webref patches. But we can skip the spec patch route if I'm the only one finding the tables useful as a reader.

In general, it looks like webref/events will need more patches, and mostly permanent patches than other extractions; our current patching approach works reasonably well for IDL fragments, but feels quite brittle for JSON data. Part of our discussion should probably revolve around the right approach for that question.

The need for permanent patches will in particular be needed to document the "proper" target for bubbling events - the extractor could already be improved to only list the deepest interface in a bubbling event (i.e. only HTMLElement ignoring Document and Window) cf https://github.com/w3c/reffy/issues/986; in many cases, when we extract targets only via IDL event handlers, there is no easy way to find the proper target (e.g. HTMLFormElement for reset) and this would have to be permanently patched over.

tidoust commented 2 years ago

I prepared the updates to scripts in Webref to also produce @webref/events in a draft PR (#650), with a view to creating and running the tests that check on the invariants.

The PR includes a first test to make sure that all interfaces in events extracts (those under interface and targets) actually exist, as that seems like an invariant that we'll want to fulfill. This is mostly the case today, except for events extracted from IndexedDB-3, see https://github.com/w3c/reffy/issues/987

foolip commented 2 years ago

Some feedback on https://github.com/w3c/webref/tree/curated/packages/events#guarantees requested by @dontcallmedom in https://github.com/openwebdocs/project/issues/61.

I wonder why not always provide bubbles? All events that fire do have event.bubbles set to true or false, and I'm not sure how to interpret the difference between bubbles being false and being missing.

On targets, the "top most interfaces in an inheritance chain" would lead to targets always containing only EventTarget, in my interpretation.

That phrasing aside, an example like the "change" event is interesting. It can fire on HTMLInputElement, HTMLSelectElement and HTMLTextareaElement. But under what circumstances do we simplify that to HTMLElement?

Has anyone compared https://raw.githubusercontent.com/w3c/webref/curated/ed/events.json to the entries in BCD yet?

dontcallmedom commented 2 years ago

I wonder why not always provide bubbles? All events that fire do have event.bubbles set to true or false, and I'm not sure how to interpret the difference between bubbles being false and being missing.

bubbles: false means the event is targeted at interfaces that are part of a bubbling tree, but are set not to bubble; bubbles missing means the event is targeted at an interface that is not part of a bubbling tree. I thought the semantic differences between the two was worth documenting, but if not, we can simplify and have bubbles: false everywhere.

an example like the "change" event is interesting. It can fire on HTMLInputElement, HTMLSelectElement and HTMLTextareaElement. But under what circumstances do we simplify that to HTMLElement?

I guess rather than "top most", we really try to keep the most specific target interfaces (i.e. change is documented as targeting HTMLInputElement and HTMLSelectElement (although not HTMLTextareaElement, a possible bug to looking into?); not sure how to phrase this correctly, nor even if there is a reasonable way of determining this in general.

Has anyone compared https://raw.githubusercontent.com/w3c/webref/curated/ed/events.json to the entries in BCD yet?

I had compared it to the *_event pages in mdn/content (see discussion in https://github.com/w3c/reffy/issues/772), but I don't think anyone has done a comparison with BCD entries yet

foolip commented 2 years ago

I wonder why not always provide bubbles? All events that fire do have event.bubbles set to true or false, and I'm not sure how to interpret the difference between bubbles being false and being missing.

bubbles: false means the event is targeted at interfaces that are part of a bubbling tree, but are set not to bubble; bubbles missing means the event is targeted at an interface that is not part of a bubbling tree. I thought the semantic differences between the two was worth documenting, but if not, we can simplify and have bubbles: false everywhere.

Is the benefit of this that it erases some silly cases where events are set to bubble even though there is no event path? Or how would one use the 3-state bubbling information differently from a boolean?

an example like the "change" event is interesting. It can fire on HTMLInputElement, HTMLSelectElement and HTMLTextareaElement. But under what circumstances do we simplify that to HTMLElement?

I guess rather than "top most", we really try to keep the most specific target interfaces (i.e. change is documented as targeting HTMLInputElement and HTMLSelectElement (although not HTMLTextareaElement, a possible bug to looking into?); not sure how to phrase this correctly, nor even if there is a reasonable way of determining this in general.

OK, most specific interface makes sense. I guess it depends on how we draw the inheritance graph if that's up or down :)

For <textarea>, I forgot this wasn't in the spec, I filed https://github.com/whatwg/html/issues/8073 a while ago.

Has anyone compared https://raw.githubusercontent.com/w3c/webref/curated/ed/events.json to the entries in BCD yet?

I had compared it to the *_event pages in mdn/content (see discussion in w3c/reffy#772), but I don't think anyone has done a comparison with BCD entries yet

Oh nice! Since @queengooborg and I have recently spent a lot of time putting event entries in the right place in BCD, comparing would be very useful to find errors in both BCD and this curated event data. I'll take a look.

tidoust commented 2 years ago

Is the benefit of this that it erases some silly cases where events are set to bubble even though there is no event path?

Internally, yes, that allows us to detect such cases. But the consolidated list is supposed not to have any such cases, so no real benefit for that in the consolidated list.

Or how would one use the 3-state bubbling information differently from a boolean?

One possible usage could be in MDN to answer the question "Does the event bubble when it fires at interface X?". Answer could be "Yes", "No", or "Not applicable, X does not belong to a bubbling tree, so the notion of bubbling does not make sense". The third answer could be conflated with "No" but it's not that the event does not bubble in practice, more that it cannot bubble in any case. Whether that's a useful distinction to make is up to MDN ;)

foolip commented 2 years ago

I see. I have no strong opinion on that bit. @Rumyra might.

foolip commented 2 years ago

OK, so here are the event types that are in https://raw.githubusercontent.com/w3c/webref/curated/ed/events.json but not in BCD:

DOMAttrModified_event DOMCharacterDataModified_event DOMFocusIn_event DOMFocusOut_event DOMNodeInsertedIntoDocument_event DOMNodeInserted_event DOMNodeRemovedFromDocument_event DOMNodeRemoved_event DOMSubtreeModified_event advertisementreceived_event beforexrselect_event begin_event captureaction_event capturehandlechange_event characterboundsupdate_event clipboardchange_event compassneedscalibration_event contextlost_event contextrestored_event currentscreenchange_event frameratechange_event isolationchange_event layoutchange_event navbeforefocus_event navnotarget_event pointerlockchange_event pointerlockerror_event portalactivate_event prerenderingchange_event redraw_event repeat_event rtctransform_event screenschange_event scrollend_event serviceadded_event servicechanged_event serviceremoved_event textformatupdate_event textupdate_event uncapturederror_event

And the reverse:

DOMMouseScroll_event MSGestureChange_event MSGestureEnd_event MSGestureHold_event MSGestureStart_event MSGestureTap_event MSInertiaStart_event MSManipulationStateChanged_event MozMousePixelScroll_event abortpayment_event active_event addstream_event afterscriptexecute_event beforescriptexecute_event beginEvent_event bounce_event cached_event checking_event devicelight_event deviceproximity_event downloading_event dragexit_event endEvent_event gesturechange_event gestureend_event gesturestart_event inactive_event merchantvalidation_event mousewheel_event msContentZoom_event noupdate_event obsolete_event overconstrained_event payerdetailchange_event removestream_event repeatEvent_event search_event shippingaddresschange_event shippingoptionchange_event typechange_event updateready_event userproximity_event vrdisplayactivate_event vrdisplayblur_event vrdisplayconnect_event vrdisplaydeactivate_event vrdisplaydisconnect_event vrdisplayfocus_event vrdisplaypointerrestricted_event vrdisplaypointerunrestricted_event vrdisplaypresentchange_event warning_event webkitmouseforcechanged_event webkitmouseforcedown_event webkitmouseforceup_event webkitmouseforcewillbegin_event

If one includes the target interfaces, there are many more differences, many events are probably on different interfaces in the two data sets.

foolip commented 2 years ago

Another way of looking at it is a diff between the two:

--- bcd.txt     2022-07-22 14:33:32.000000000 +0200
+++ webref.txt  2022-07-22 14:33:23.000000000 +0200
@@ -1,454 +1,542 @@
 AbortSignal/abort_event
 Animation/cancel_event
 Animation/finish_event
 Animation/remove_event
-ApplicationCache/cached_event
-ApplicationCache/checking_event
-ApplicationCache/downloading_event
-ApplicationCache/error_event
-ApplicationCache/noupdate_event
-ApplicationCache/obsolete_event
-ApplicationCache/progress_event
-ApplicationCache/updateready_event
+Attr/DOMNodeInsertedIntoDocument_event
+Attr/DOMNodeInserted_event
+Attr/DOMNodeRemovedFromDocument_event
+Attr/DOMNodeRemoved_event
+Attr/DOMSubtreeModified_event
+AudioRenderCapacity/update_event
 AudioScheduledSourceNode/ended_event
 AudioTrackList/addtrack_event
 AudioTrackList/change_event
 AudioTrackList/removetrack_event
 AudioWorkletNode/processorerror_event
 BackgroundFetchRegistration/progress_event
 BaseAudioContext/statechange_event
 BatteryManager/chargingchange_event
 BatteryManager/chargingtimechange_event
 BatteryManager/dischargingtimechange_event
 BatteryManager/levelchange_event
+Bluetooth/advertisementreceived_event
 Bluetooth/availabilitychanged_event
 BluetoothDevice/gattserverdisconnected_event
 BluetoothRemoteGATTCharacteristic/characteristicvaluechanged_event
+BluetoothRemoteGATTService/serviceadded_event
+BluetoothRemoteGATTService/servicechanged_event
+BluetoothRemoteGATTService/serviceremoved_event
 BroadcastChannel/message_event
 BroadcastChannel/messageerror_event
+CloseWatcher/cancel_event
+CloseWatcher/close_event
+Comment/DOMCharacterDataModified_event
+Comment/DOMNodeInsertedIntoDocument_event
+Comment/DOMNodeInserted_event
+Comment/DOMNodeRemovedFromDocument_event
+Comment/DOMNodeRemoved_event
 CookieStore/change_event
 DedicatedWorkerGlobalScope/message_event
 DedicatedWorkerGlobalScope/messageerror_event
+DedicatedWorkerGlobalScope/rtctransform_event
+DevicePosture/change_event
 Document/DOMContentLoaded_event
-Document/afterscriptexecute_event
-Document/beforescriptexecute_event
 Document/freeze_event
-Document/fullscreenchange_event
-Document/fullscreenerror_event
-Document/lostpointercapture_event
+Document/load_event
+Document/pointerenter_event
+Document/pointerleave_event
+Document/pointerlockchange_event
+Document/pointerlockerror_event
+Document/prerenderingchange_event
 Document/readystatechange_event
 Document/resume_event
-Document/scroll_event
-Document/securitypolicyviolation_event
 Document/selectionchange_event
+Document/unload_event
 Document/visibilitychange_event
+DocumentFragment/DOMSubtreeModified_event
+DocumentType/DOMNodeInsertedIntoDocument_event
+DocumentType/DOMNodeInserted_event
+DocumentType/DOMNodeRemovedFromDocument_event
+DocumentType/DOMNodeRemoved_event
+EditContext/characterboundsupdate_event
+EditContext/compositionend_event
+EditContext/compositionstart_event
+EditContext/textformatupdate_event
+EditContext/textupdate_event
 Element/DOMActivate_event
-Element/DOMMouseScroll_event
-Element/MSGestureChange_event
-Element/MSGestureEnd_event
-Element/MSGestureHold_event
-Element/MSGestureStart_event
-Element/MSGestureTap_event
-Element/MSInertiaStart_event
-Element/MSManipulationStateChanged_event
-Element/MozMousePixelScroll_event
-Element/afterscriptexecute_event
-Element/animationcancel_event
-Element/animationend_event
-Element/animationiteration_event
-Element/animationstart_event
+Element/DOMAttrModified_event
+Element/DOMFocusIn_event
+Element/DOMFocusOut_event
+Element/DOMNodeInsertedIntoDocument_event
+Element/DOMNodeInserted_event
+Element/DOMNodeRemovedFromDocument_event
+Element/DOMNodeRemoved_event
+Element/DOMSubtreeModified_event
+Element/abort_event
 Element/auxclick_event
-Element/beforescriptexecute_event
+Element/beforeinput_event
 Element/blur_event
 Element/click_event
 Element/compositionend_event
 Element/compositionstart_event
 Element/compositionupdate_event
 Element/contextmenu_event
-Element/copy_event
-Element/cut_event
 Element/dblclick_event
 Element/error_event
 Element/focus_event
 Element/focusin_event
 Element/focusout_event
 Element/fullscreenchange_event
 Element/fullscreenerror_event
-Element/gesturechange_event
-Element/gestureend_event
-Element/gesturestart_event
-Element/gotpointercapture_event
+Element/input_event
 Element/keydown_event
 Element/keypress_event
 Element/keyup_event
-Element/lostpointercapture_event
+Element/load_event
 Element/mousedown_event
 Element/mouseenter_event
 Element/mouseleave_event
 Element/mousemove_event
 Element/mouseout_event
 Element/mouseover_event
 Element/mouseup_event
-Element/mousewheel_event
-Element/msContentZoom_event
-Element/paste_event
-Element/pointercancel_event
-Element/pointerdown_event
-Element/pointerenter_event
-Element/pointerleave_event
-Element/pointermove_event
-Element/pointerout_event
-Element/pointerover_event
-Element/pointerrawupdate_event
-Element/pointerup_event
 Element/scroll_event
-Element/securitypolicyviolation_event
-Element/show_event
+Element/scrollend_event
+Element/select_event
 Element/touchcancel_event
 Element/touchend_event
 Element/touchmove_event
 Element/touchstart_event
-Element/transitioncancel_event
-Element/transitionend_event
-Element/transitionrun_event
-Element/transitionstart_event
-Element/webkitmouseforcechanged_event
-Element/webkitmouseforcedown_event
-Element/webkitmouseforceup_event
-Element/webkitmouseforcewillbegin_event
+Element/unload_event
 Element/wheel_event
 EventSource/error_event
 EventSource/message_event
 EventSource/open_event
 FileReader/abort_event
 FileReader/error_event
 FileReader/load_event
 FileReader/loadend_event
 FileReader/loadstart_event
 FileReader/progress_event
 FontFaceSet/loading_event
 FontFaceSet/loadingdone_event
 FontFaceSet/loadingerror_event
+GPUDevice/uncapturederror_event
 HID/connect_event
 HID/disconnect_event
 HIDDevice/inputreport_event
+HTMLButtonElement/invalid_event
+HTMLCanvasElement/contextlost_event
+HTMLCanvasElement/contextrestored_event
 HTMLCanvasElement/webglcontextcreationerror_event
 HTMLCanvasElement/webglcontextlost_event
 HTMLCanvasElement/webglcontextrestored_event
 HTMLDetailsElement/toggle_event
 HTMLDialogElement/cancel_event
 HTMLDialogElement/close_event
-HTMLElement/beforeinput_event
+HTMLElement/animationcancel_event
+HTMLElement/animationend_event
+HTMLElement/animationiteration_event
+HTMLElement/animationstart_event
 HTMLElement/beforematch_event
-HTMLElement/change_event
+HTMLElement/beforexrselect_event
+HTMLElement/clipboardchange_event
+HTMLElement/copy_event
+HTMLElement/cut_event
 HTMLElement/drag_event
 HTMLElement/dragend_event
 HTMLElement/dragenter_event
-HTMLElement/dragexit_event
 HTMLElement/dragleave_event
 HTMLElement/dragover_event
 HTMLElement/dragstart_event
 HTMLElement/drop_event
-HTMLElement/input_event
+HTMLElement/gotpointercapture_event
+HTMLElement/lostpointercapture_event
+HTMLElement/navbeforefocus_event
+HTMLElement/navnotarget_event
+HTMLElement/paste_event
+HTMLElement/pointercancel_event
+HTMLElement/pointerdown_event
+HTMLElement/pointerenter_event
+HTMLElement/pointerleave_event
+HTMLElement/pointermove_event
+HTMLElement/pointerout_event
+HTMLElement/pointerover_event
+HTMLElement/pointerrawupdate_event
+HTMLElement/pointerup_event
+HTMLElement/securitypolicyviolation_event
+HTMLElement/selectionchange_event
+HTMLElement/selectstart_event
+HTMLElement/transitioncancel_event
+HTMLElement/transitionend_event
+HTMLElement/transitionrun_event
+HTMLElement/transitionstart_event
 HTMLFormElement/formdata_event
 HTMLFormElement/reset_event
 HTMLFormElement/submit_event
 HTMLInputElement/cancel_event
+HTMLInputElement/change_event
 HTMLInputElement/invalid_event
-HTMLInputElement/search_event
 HTMLInputElement/select_event
-HTMLInputElement/selectionchange_event
-HTMLMarqueeElement/bounce_event
-HTMLMarqueeElement/finish_event
-HTMLMarqueeElement/start_event
 HTMLMediaElement/abort_event
 HTMLMediaElement/canplay_event
 HTMLMediaElement/canplaythrough_event
 HTMLMediaElement/durationchange_event
 HTMLMediaElement/emptied_event
 HTMLMediaElement/encrypted_event
 HTMLMediaElement/ended_event
 HTMLMediaElement/error_event
 HTMLMediaElement/loadeddata_event
 HTMLMediaElement/loadedmetadata_event
 HTMLMediaElement/loadstart_event
 HTMLMediaElement/pause_event
 HTMLMediaElement/play_event
 HTMLMediaElement/playing_event
 HTMLMediaElement/progress_event
 HTMLMediaElement/ratechange_event
+HTMLMediaElement/resize_event
 HTMLMediaElement/seeked_event
 HTMLMediaElement/seeking_event
 HTMLMediaElement/stalled_event
 HTMLMediaElement/suspend_event
 HTMLMediaElement/timeupdate_event
 HTMLMediaElement/volumechange_event
 HTMLMediaElement/waiting_event
 HTMLMediaElement/waitingforkey_event
-HTMLSlotElement/slotchange_event
+HTMLPortalElement/message_event
+HTMLPortalElement/messageerror_event
+HTMLSelectElement/change_event
+HTMLSelectElement/invalid_event
+HTMLSourceElement/error_event
+HTMLTextAreaElement/invalid_event
 HTMLTextAreaElement/select_event
-HTMLTextAreaElement/selectionchange_event
 HTMLTrackElement/cuechange_event
+HTMLTrackElement/error_event
+HTMLTrackElement/load_event
 HTMLVideoElement/enterpictureinpicture_event
 HTMLVideoElement/leavepictureinpicture_event
-HTMLVideoElement/resize_event
 IDBDatabase/close_event
 IDBDatabase/versionchange_event
 IDBOpenDBRequest/blocked_event
+IDBOpenDBRequest/success_event
 IDBOpenDBRequest/upgradeneeded_event
 IDBRequest/error_event
 IDBRequest/success_event
 IDBTransaction/abort_event
 IDBTransaction/complete_event
-IDBTransaction/error_event
 IdleDetector/change_event
+Keyboard/layoutchange_event
 MIDIAccess/statechange_event
 MIDIInput/midimessage_event
 MIDIPort/statechange_event
+MathMLElement/animationcancel_event
+MathMLElement/animationend_event
+MathMLElement/animationiteration_event
+MathMLElement/animationstart_event
+MathMLElement/beforexrselect_event
+MathMLElement/clipboardchange_event
+MathMLElement/copy_event
+MathMLElement/cut_event
+MathMLElement/drag_event
+MathMLElement/dragend_event
+MathMLElement/dragenter_event
+MathMLElement/dragleave_event
+MathMLElement/dragover_event
+MathMLElement/dragstart_event
+MathMLElement/drop_event
+MathMLElement/gotpointercapture_event
+MathMLElement/lostpointercapture_event
+MathMLElement/paste_event
+MathMLElement/pointercancel_event
+MathMLElement/pointerdown_event
+MathMLElement/pointerenter_event
+MathMLElement/pointerleave_event
+MathMLElement/pointermove_event
+MathMLElement/pointerout_event
+MathMLElement/pointerover_event
+MathMLElement/pointerrawupdate_event
+MathMLElement/pointerup_event
+MathMLElement/selectionchange_event
+MathMLElement/selectstart_event
+MathMLElement/transitioncancel_event
+MathMLElement/transitionend_event
+MathMLElement/transitionrun_event
+MathMLElement/transitionstart_event
+MediaDevices/captureaction_event
 MediaDevices/devicechange_event
 MediaKeySession/keystatuseschange_event
 MediaKeySession/message_event
 MediaQueryList/change_event
 MediaRecorder/dataavailable_event
 MediaRecorder/error_event
 MediaRecorder/pause_event
 MediaRecorder/resume_event
 MediaRecorder/start_event
 MediaRecorder/stop_event
-MediaRecorder/warning_event
 MediaSource/sourceclose_event
 MediaSource/sourceended_event
 MediaSource/sourceopen_event
-MediaStream/active_event
 MediaStream/addtrack_event
-MediaStream/inactive_event
 MediaStream/removetrack_event
+MediaStreamTrack/capturehandlechange_event
 MediaStreamTrack/ended_event
+MediaStreamTrack/isolationchange_event
 MediaStreamTrack/mute_event
-MediaStreamTrack/overconstrained_event
 MediaStreamTrack/unmute_event
 MessagePort/message_event
 MessagePort/messageerror_event
 NDEFReader/reading_event
 NDEFReader/readingerror_event
 Navigation/currententrychange_event
 Navigation/navigate_event
 Navigation/navigateerror_event
 Navigation/navigatesuccess_event
 NavigationHistoryEntry/dispose_event
 NetworkInformation/change_event
-NetworkInformation/typechange_event
-Node/selectstart_event
 Notification/click_event
 Notification/close_event
 Notification/error_event
 Notification/show_event
 OfflineAudioContext/complete_event
-PaymentRequest/merchantvalidation_event
+OffscreenCanvas/contextlost_event
+OffscreenCanvas/contextrestored_event
+OffscreenCanvas/webglcontextcreationerror_event
+OffscreenCanvas/webglcontextlost_event
+OffscreenCanvas/webglcontextrestored_event
 PaymentRequest/paymentmethodchange_event
-PaymentRequest/shippingaddresschange_event
-PaymentRequest/shippingoptionchange_event
-PaymentResponse/payerdetailchange_event
 Performance/resourcetimingbufferfull_event
 PermissionStatus/change_event
 PictureInPictureWindow/resize_event
+PortalHost/message_event
+PortalHost/messageerror_event
 PresentationAvailability/change_event
 PresentationConnection/close_event
 PresentationConnection/connect_event
 PresentationConnection/message_event
 PresentationConnection/terminate_event
 PresentationConnectionList/connectionavailable_event
 PresentationRequest/connectionavailable_event
+ProcessingInstruction/DOMCharacterDataModified_event
+ProcessingInstruction/DOMNodeInsertedIntoDocument_event
+ProcessingInstruction/DOMNodeInserted_event
+ProcessingInstruction/DOMNodeRemovedFromDocument_event
+ProcessingInstruction/DOMNodeRemoved_event
 RTCDTMFSender/tonechange_event
 RTCDataChannel/bufferedamountlow_event
 RTCDataChannel/close_event
 RTCDataChannel/closing_event
 RTCDataChannel/error_event
 RTCDataChannel/message_event
 RTCDataChannel/open_event
 RTCDtlsTransport/error_event
 RTCDtlsTransport/statechange_event
 RTCIceTransport/gatheringstatechange_event
+RTCIceTransport/icecandidate_event
+RTCIceTransport/icecandidateerror_event
 RTCIceTransport/selectedcandidatepairchange_event
 RTCIceTransport/statechange_event
-RTCPeerConnection/addstream_event
 RTCPeerConnection/connectionstatechange_event
 RTCPeerConnection/datachannel_event
 RTCPeerConnection/icecandidate_event
 RTCPeerConnection/icecandidateerror_event
 RTCPeerConnection/iceconnectionstatechange_event
 RTCPeerConnection/icegatheringstatechange_event
 RTCPeerConnection/negotiationneeded_event
-RTCPeerConnection/removestream_event
 RTCPeerConnection/signalingstatechange_event
 RTCPeerConnection/track_event
 RTCSctpTransport/statechange_event
 RemotePlayback/connect_event
 RemotePlayback/connecting_event
 RemotePlayback/disconnect_event
-SVGAnimationElement/beginEvent_event
-SVGAnimationElement/endEvent_event
-SVGAnimationElement/repeatEvent_event
-SVGElement/error_event
-SVGElement/load_event
-Screen/orientationchange_event
+SFrameTransform/error_event
+SVGAnimationElement/begin_event
+SVGAnimationElement/end_event
+SVGAnimationElement/repeat_event
+SVGElement/animationcancel_event
+SVGElement/animationend_event
+SVGElement/animationiteration_event
+SVGElement/animationstart_event
+SVGElement/beforexrselect_event
+SVGElement/clipboardchange_event
+SVGElement/copy_event
+SVGElement/cut_event
+SVGElement/drag_event
+SVGElement/dragend_event
+SVGElement/dragenter_event
+SVGElement/dragleave_event
+SVGElement/dragover_event
+SVGElement/dragstart_event
+SVGElement/drop_event
+SVGElement/gotpointercapture_event
+SVGElement/lostpointercapture_event
+SVGElement/paste_event
+SVGElement/pointercancel_event
+SVGElement/pointerdown_event
+SVGElement/pointerenter_event
+SVGElement/pointerleave_event
+SVGElement/pointermove_event
+SVGElement/pointerout_event
+SVGElement/pointerover_event
+SVGElement/pointerrawupdate_event
+SVGElement/pointerup_event
+SVGElement/selectionchange_event
+SVGElement/selectstart_event
+SVGElement/transitioncancel_event
+SVGElement/transitionend_event
+SVGElement/transitionrun_event
+SVGElement/transitionstart_event
+Screen/change_event
+ScreenDetailed/change_event
+ScreenDetails/currentscreenchange_event
+ScreenDetails/screenschange_event
 ScreenOrientation/change_event
 ScriptProcessorNode/audioprocess_event
 Sensor/activate_event
 Sensor/error_event
 Sensor/reading_event
 SerialPort/connect_event
 SerialPort/disconnect_event
 ServiceWorker/error_event
 ServiceWorker/statechange_event
 ServiceWorkerContainer/controllerchange_event
-ServiceWorkerContainer/error_event
 ServiceWorkerContainer/message_event
 ServiceWorkerContainer/messageerror_event
-ServiceWorkerGlobalScope/abortpayment_event
 ServiceWorkerGlobalScope/activate_event
 ServiceWorkerGlobalScope/backgroundfetchabort_event
 ServiceWorkerGlobalScope/backgroundfetchclick_event
 ServiceWorkerGlobalScope/backgroundfetchfail_event
 ServiceWorkerGlobalScope/backgroundfetchsuccess_event
 ServiceWorkerGlobalScope/canmakepayment_event
 ServiceWorkerGlobalScope/contentdelete_event
 ServiceWorkerGlobalScope/cookiechange_event
 ServiceWorkerGlobalScope/fetch_event
 ServiceWorkerGlobalScope/install_event
 ServiceWorkerGlobalScope/message_event
 ServiceWorkerGlobalScope/messageerror_event
 ServiceWorkerGlobalScope/notificationclick_event
 ServiceWorkerGlobalScope/notificationclose_event
 ServiceWorkerGlobalScope/paymentrequest_event
 ServiceWorkerGlobalScope/periodicsync_event
 ServiceWorkerGlobalScope/push_event
 ServiceWorkerGlobalScope/pushsubscriptionchange_event
 ServiceWorkerGlobalScope/sync_event
 ServiceWorkerRegistration/updatefound_event
+ShadowRoot/slotchange_event
 SharedWorker/error_event
 SharedWorkerGlobalScope/connect_event
 SourceBuffer/abort_event
 SourceBuffer/error_event
 SourceBuffer/update_event
 SourceBuffer/updateend_event
 SourceBuffer/updatestart_event
 SourceBufferList/addsourcebuffer_event
 SourceBufferList/removesourcebuffer_event
 SpeechRecognition/audioend_event
 SpeechRecognition/audiostart_event
 SpeechRecognition/end_event
 SpeechRecognition/error_event
 SpeechRecognition/nomatch_event
 SpeechRecognition/result_event
 SpeechRecognition/soundend_event
 SpeechRecognition/soundstart_event
 SpeechRecognition/speechend_event
 SpeechRecognition/speechstart_event
 SpeechRecognition/start_event
 SpeechSynthesis/voiceschanged_event
 SpeechSynthesisUtterance/boundary_event
 SpeechSynthesisUtterance/end_event
 SpeechSynthesisUtterance/error_event
 SpeechSynthesisUtterance/mark_event
 SpeechSynthesisUtterance/pause_event
 SpeechSynthesisUtterance/resume_event
 SpeechSynthesisUtterance/start_event
 TaskSignal/prioritychange_event
+Text/DOMCharacterDataModified_event
+Text/DOMNodeInsertedIntoDocument_event
+Text/DOMNodeInserted_event
+Text/DOMNodeRemovedFromDocument_event
+Text/DOMNodeRemoved_event
 TextTrack/cuechange_event
 TextTrackCue/enter_event
 TextTrackCue/exit_event
 TextTrackList/addtrack_event
 TextTrackList/change_event
 TextTrackList/removetrack_event
 USB/connect_event
 USB/disconnect_event
 VideoTrackList/addtrack_event
 VideoTrackList/change_event
 VideoTrackList/removetrack_event
 VirtualKeyboard/geometrychange_event
-VisualViewport/resize_event
-VisualViewport/scroll_event
 WakeLockSentinel/release_event
 WebSocket/close_event
 WebSocket/error_event
 WebSocket/message_event
 WebSocket/open_event
-Window/DOMContentLoaded_event
+Window/abort_event
 Window/afterprint_event
 Window/appinstalled_event
 Window/beforeinstallprompt_event
 Window/beforeprint_event
 Window/beforeunload_event
 Window/blur_event
-Window/devicelight_event
+Window/compassneedscalibration_event
 Window/devicemotion_event
 Window/deviceorientation_event
 Window/deviceorientationabsolute_event
-Window/deviceproximity_event
 Window/error_event
 Window/focus_event
 Window/gamepadconnected_event
 Window/gamepaddisconnected_event
 Window/hashchange_event
 Window/languagechange_event
 Window/load_event
 Window/message_event
 Window/messageerror_event
 Window/offline_event
 Window/online_event
 Window/orientationchange_event
 Window/pagehide_event
 Window/pageshow_event
+Window/pointerenter_event
+Window/pointerleave_event
 Window/popstate_event
+Window/portalactivate_event
 Window/rejectionhandled_event
 Window/resize_event
+Window/selectionchange_event
 Window/storage_event
 Window/unhandledrejection_event
 Window/unload_event
-Window/userproximity_event
-Window/vrdisplayactivate_event
-Window/vrdisplayblur_event
-Window/vrdisplayconnect_event
-Window/vrdisplaydeactivate_event
-Window/vrdisplaydisconnect_event
-Window/vrdisplayfocus_event
-Window/vrdisplaypointerrestricted_event
-Window/vrdisplaypointerunrestricted_event
-Window/vrdisplaypresentchange_event
 WindowControlsOverlay/geometrychange_event
 Worker/error_event
 Worker/message_event
 Worker/messageerror_event
 WorkerGlobalScope/error_event
 WorkerGlobalScope/languagechange_event
 WorkerGlobalScope/offline_event
 WorkerGlobalScope/online_event
-WorkerGlobalScope/securitypolicyviolation_event
+WorkerGlobalScope/rejectionhandled_event
+WorkerGlobalScope/unhandledrejection_event
 XMLHttpRequest/abort_event
 XMLHttpRequest/error_event
 XMLHttpRequest/load_event
 XMLHttpRequest/loadend_event
 XMLHttpRequest/loadstart_event
 XMLHttpRequest/progress_event
 XMLHttpRequest/readystatechange_event
 XMLHttpRequest/timeout_event
-XMLHttpRequestUpload/abort_event
-XMLHttpRequestUpload/error_event
-XMLHttpRequestUpload/load_event
-XMLHttpRequestUpload/loadend_event
-XMLHttpRequestUpload/loadstart_event
-XMLHttpRequestUpload/progress_event
-XMLHttpRequestUpload/timeout_event
+XRLayer/redraw_event
 XRLightProbe/reflectionchange_event
 XRReferenceSpace/reset_event
 XRSession/end_event
+XRSession/frameratechange_event
 XRSession/inputsourceschange_event
 XRSession/select_event
 XRSession/selectend_event
 XRSession/selectstart_event
 XRSession/squeeze_event
 XRSession/squeezeend_event
 XRSession/squeezestart_event
 XRSession/visibilitychange_event
 XRSystem/devicechange_event
foolip commented 2 years ago

A lot of this is non-standard, but at least these events that are missing from the webref data:

tidoust commented 2 years ago

A lot of this is non-standard, but at least these events that are missing from the webref data:

* `VisualViewport` events

That's a bug in CSSOM View, see pending PR: https://github.com/w3c/csswg-drafts/pull/7479

* "selectstart" event on `Text` nodes

This one is interesting. The extraction code assumes that the event only fires at interfaces that implement GlobalEventHandlers because this is where the onselectstart IDL attribute is defined. It misses Text because there it does not have an onselectstart IDL attribute. We'll have to handle it through patching. I was expecting all events that fire on an interface to have an associated onxx attribute (unless spec has a bug of course). Is that the only exception to the rule? And is that normal?

* IDBTransaction/error_event

Unless I missed something, that's one example of a bubbling situation where the consolidated list only contains the deepest target interface in the tree (IDBRequest) on which the bubbling event error may fire. The error event can de facto fire at IDBTransaction (and at IDBDatabase) through bubbling.

Ideally, we would be able to list precisely all target interfaces at which an event can really fire. In practice, these target interfaces are most of the time determined by looking at where onxx attributes are defined because there is no easy way to extract the exact target interfaces from spec prose. For bubbling events, we cannot automatically tell whether an interface is a real target interface, or just happens to be on the bubbling path. That's why we decided to only list the deepest interface in the bubbling tree. In this particular case, the ideal list would be ["IDBRequest", "IDBTransaction"] but if we didn't filter out interfaces on the bubbling path, the list would also include "IDBDatabase".

This could be fixed through patching but we'd have to review all bubbling situations (165 occurrences in the current list) and review new ones periodically.

dontcallmedom commented 2 years ago
  • "selectstart" event on Text nodes

It misses Text because there it does not have an onselectstart IDL attribute. […]. I was expecting all events that fire on an interface to have an associated onxx attribute (unless spec has a bug of course).

The relevant TAG principle on this: https://w3ctag.github.io/design-principles/#always-add-event-handlers

I've filed https://github.com/w3c/selection-api/issues/159 to suggest adding the missing handler to Text.

dontcallmedom commented 2 years ago

https://www.npmjs.com/package/@webref/events has the first release of the @webref/events package - we fully expect that the data and format will have to evolve based on input from consumers, but this is probably a good enough starting point for closing this issue.