-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add events compat data #935
Comments
Hi Sheppy, tl;dr; Complete answer Yes, I think that having an id: event.eventname.interfacename is the good way to go, as it makes easy to generate the BCD table on the event page. For the naming of the files, I think we should have one file per eventname which each entry for the different interface in there. So keydown.json will contain an entry for event.keydown.KeyboardEvent and eventually another for event.keydown.OtherInterface About your outstanding question, I think it isn't a problem: we don't document specs, we document implementation, so if 2 specs are incompatible, we document what is implemented. |
I concur. That's my preference. I think it will be easier to manage, and more in keeping with how we're moving toward doing the same in the documentation. I take it, then, that the actual JSON would have something like:
The main question I have is about |
What's the rationale for separating event targets from APIs? I was just thinking about how |
@mdittmer - This isn't actually about event targets but about the events themselves. This is strictly about organizing the events, given that events by the same name can have different contents and meanings depending on which API they're used by. For example, the We don't need to, and should not, I think, actually allow sub-features in the events JSON. The event interface names and the Sheppy |
https://developer.mozilla.org/en-US/docs/Web/Events/close is in fact an extreme example and I don't like how the documentation is done there. I don't know much about how MDN readers use event pages. I guess somewhere you have a "close" fired and then you want to read about it. However, the "close" page has not much information, no code samples, no details about each of the various close events. Pages where there is only one event described, like https://developer.mozilla.org/en-US/docs/Web/Events/webglcontextcreationerror, are better imo, but the info is also similar to say the info on https://developer.mozilla.org/en-US/docs/Web/API/WebGLContextEvent. So, I think "collection pages" like "close" are not really useful, except for pointing to pages where each of the close events is described in more details. So, if I were to document "close" events I would create something like:
For browser compat data, we then either have the data in an own tree and by target interface like this (events/targetInterface.json is the file):
Or, we add events to the target interfaces directly, say like this (api/targetInterface.json is the file):
|
OK, that makes sense. I still personally like them better on one page but I can see the issues you raise are legitimate ones, too. :) If we make this change, we will also need to change the So I propose we create a new macro to replace it, called perhaps
Examples:
Only the first parameter,
|
We've started refactoring the event docs, please see: mdn/sprints#685 (and discuss docs refactoring plans there) As for adding events to this repo, we're now about to install them under "targetInterface.eventname_event". See the first two PRs on this: I'm leaving this issue open until we're done refactoring and events compat data has been migrated. |
All legacy compat tables for events have been migrated and we have a convention for adding more in the future. Thanks everyone who was involved with this work. |
We need to have a place to place compatibility data for events. I propose we add a top-level "events" folder, inside which we place the JSON files for each event.
Because the same event can be used by multiple interfaces, sometimes with different event interfaces (
Event
vsKeyboardEvent
for example), we need to decide how to handle these. In content, we have shifted to documenting all of these on one page, with sections for each of the various versions of the event.For BCD purposes, I propose that each specification's version of the event be placed in a file named
eventname-interfacename
, and that they be referenced using the nameevent.eventname.interfacename
.So for the
KeyboardEvent
namedkeydown
, the file would bekeydown-KeyboardEvent.json
and it would be referred to using the nameevent.keydown.keyboardevent
(orevent.keydown.KeyboardEvent
if we use camelcased names).One outstanding question: If two specifications use the same form of the event, should they share a BCD file, or use separate ones? Sharing is tempting for convenience, but what if they deviate over time?
The text was updated successfully, but these errors were encountered: