Skip to content
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

Cover global/window events #1111

Open
Elchi3 opened this issue Jan 26, 2024 · 1 comment
Open

Cover global/window events #1111

Elchi3 opened this issue Jan 26, 2024 · 1 comment
Assignees

Comments

@Elchi3
Copy link
Member

Elchi3 commented Jan 26, 2024

In #879 I re-enabled collecting compat data for events, but skipped those for global/window event handlers:

const skipIncludes = [
  "WindowOrWorkerGlobalScope", // handled separately as globals
  "GlobalEventHandlers", // XXX needs special handling
  "WindowEventHandlers", // XXX needs special handling
];

https://github.com/openwebdocs/mdn-bcd-collector/blob/9e556b0fdea227e5c9aa549e8bf4138dfe188fbd/test-builder/api.ts#L92C1-L96C9

To meet our coverage goal of 90% (see openwebdocs/project#161), we want to sort our coverage of events (the work on events will add coverage of ~175 more data entries)

The GlobalEventHandlers and WindowEventHandlers mixins are mixed into a lot of interfaces and we don't want the collector to add these to all of them. So likely a mapping will be needed. BCD already does that, but the mapping isn't scripted anywhere so there might be bugs with it, too. Mapping it here in the collector will likely help to ensure consistency. Then there is also bubbling and that might not be handled consistently yet either, so maybe we need even more mappings.

I volunteered to implement this. Wish me luck :)

@Elchi3 Elchi3 self-assigned this Jan 26, 2024
@foolip
Copy link
Member

foolip commented Feb 13, 2024

The way I would approach this is to start with a list of interfaces that don't get their own onfoo event handler properties because they are instead added to GlobalEventHandlers or WindowEventHandlers. That's Window, Document, HTML*Element, and perhaps some others.

If BCD has a foo_event key for one of those interfaces and there's an onfoo attribute in Web IDL for the same interface, then we should generate a test that simply checks for onfoo on the prototype or an instance.

Using api.HTMLMediaElement.volumechange_event as an example, we should note that HTMLMediaElement is a special interface, confirm that onvolumechange is in the GlobalEventHandlers mixins, and proceed to generate this test:

(function () {
  var instance = document.createElement("video");
  return !!instance && "onvolumechange" in instance;
})();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants