Open tidoust opened 2 months ago
I've been looking into adding a check to Strudy's study-webidl
. A couple of things make that slightly painful:
EventHandler
attribute even though the related event does not fire at it, when the interfaces are part of a bubbling tree, and when the event bubbles. That's more painful to test: either we start from the consolidated events.json
file or we need to expose Reffy's bubbling logic somehow. In practice, we're only talking about a couple of events in IndexedDB, most other bubbling events get simply captured through inheritance (in HTML, event handlers are defined on HTMLElement
).I'll try to prepare something relatively clean for integration in Strudy. In the meantime, the analysis reveals that we could almost guarantee that "all event handlers get targeted by a suitable event", but for the following cases:
orientationchange
event found for HTMLBodyElement.onorientationchange
(compat).
This one is interesting because we're the ones who remove the HTMLBodyElement
target. The IDL definition of HTMLBodyElement
does have the event handler though. I guess that's going to remain an exception to the rule? (That is, unless you're on iOS Safari, the event handler will indeed never be called).error
event found for RTCIceTransport.onerror
(webrtc-ice).
Also interesting because there is an event but its name is icecandidateerror
. That seems to be the only case where the name of the event handler attribute is not the expected one. Any reason why the event handler was not named onicecandidateerror
?[Edit: problems reported and fixed] This also reveals 4 other problems in WebXR Layers, where the redraw
event is defined to target the root XRLayer
interface, whereas the event handlers are defined on specific interfaces that inherit from XRLayer
. I'll report the errors:
redraw
event found for XRQuadLayer.onredraw
(webxrlayers-1)redraw
event found for XRCylinderLayer.onredraw
(webxrlayers-1)redraw
event found for XREquirectLayer.onredraw
(webxrlayers-1)redraw
event found for XRCubeLayer.onredraw
(webxrlayers-1)While digging into data, I also bumped into the definition of XHR events, which are currently defined with a data-dfn-for="XMLHttpRequest"
attribute, while they also fire on XMLHttpRequestUpload
. The attribute should rather be data-dfn-for="XMLHttpRequestEventTarget"
.
Via https://github.com/w3c/webref/issues/1212#issuecomment-2058877542.
We already use the fact that an interface inherits from
EventTarget
to find target interfaces for events when we extract them from the specs, but we don't have test in place that checks that:EventTarget
are targeted by at least one event (for example: there should be events that targetCloseWatcher
)EventHandler
attributes in such interfaces (for example: there should acancel
event that targetsCloseWatcher
because it has anoncancel
attribute.Depending on what research reveals, this test could be turned into a guarantee for the
@webref/events
package. There may be exceptions to the rule though (such as new interfaces for which the draft spec does not yet correctly define associated events)