-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Adding subfeatures guidance #17352
base: main
Are you sure you want to change the base?
Adding subfeatures guidance #17352
Changes from all commits
7795521
b163287
fa6b76f
1251cd2
81b61eb
aeb546f
a6b4524
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,55 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# Data guidelines for when to add features | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This file contains specific guidelines on when to add features to BCD, and the various types of features tracked in BCD. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
## Glossary | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- Feature: some trackable feature supported in a browser or runtime | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- Subfeature: any feature whose support is directly dependent on a parent (for example, the property of an interface) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- Top-level feature: a feature that lives at the top of a category (for example, an interface, a CSS property, etc.) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- Behavioral feature: a feature that describes the behavior of the browser or runtime (for example, security requirements, sorting, worker support, etc.) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- Parameter feature: a feature that describes the support for a return type, method parameter, property value, etc. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
## Adding features and subfeatures | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A JSON file should be created for every _top level feature_ that has support in any of the browsers or runtimes tracked in BCD. For Web APIs, the top level features are individual Web API interfaces. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A possible structure for a Web API is shown below: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
category // category name (always `api` for API interfaces) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
interface // top level feature | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
properties // subfeature, add if supported | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
property values // parameter subfeature, add all of them if not all values were supported since property was introduced | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
methods // subfeature, add if supported | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
parameters // parameter subfeature, add all of them if not all parameters were supported since method was introduced | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
parameter options // parameter subfeature, add all of them if not all parameter options were supported since property was introduced | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
parameter type // parameter subfeature, add all of them if not all parameter types were supported since property was introduced | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
support in workers // behavioral subfeature, add if compatibility is different (might also just be on specific methods) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The interface must include subfeatures for _all_ its properties and methods that have an implementation in at least one of the supported browsers, whether or not they were added at the same time as the parent interface. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
All other code and behavioral aspects of the interface are given nested nodes **only** if their compatibility is _different_ to that of their parent feature. This applies to method arguments, method argument options, and behavior changes like the addition of support for workers, or the type of return value. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> [!TIP] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> A good rule of thumb is that if a behavioral subfeature has the same compatibility information as its parent, then the subfeature is not needed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> Another good rule of thumb is that if the signature of a method changes to introduce new parameters, then all parameters should be documented. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Here is an example scenario: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep it simple:
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- An interface is defined in a specification with a method that has two parameters. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- A supported browser implements the method and both the parameters: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- A feature node is created for the method (by default) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- Subfeature nodes are not created for the method parameters because they were created in the same version as the methods; there is no compatibility change. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- Another browser implements the methods, but only one of the parameters. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- A subfeature node is added to the method parameter that was supported by _both_ browsers. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- Another subfeature node is added to the method parameter that was _not_ supported by the second browser. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- Yet another browser implements the method with a new parameter. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- A method subfeature is added for the new parameter because it was added in a different version than the parent method. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- The browser changes to require that the interface now can be used in workers: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- A "supported in workers" subfeature is added to the interface feature because this is a change in compatibility. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+41
to
+52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's how I would restructure the example for better readability:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @caugner I have no problem with this alternative approach, but I think I'd like the change the rule, not that I've been around a while. The "rule" for API properties and methods is that you always add entries for all that are supported. The current rule for method arguments (as I understand it and stated there) is that you only document the incompatibility. So the assumption is that if something is not documented then it is compatible. I'd like to change the rule to "As soon as there is an incompatibility you should document all parameters including those that were in the original version. The reason is that as it is now there is no way to spot whether something is compatible or has just been omitted. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Upshot, if we know the rules I'm open to any presentation at all. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this PR explains the rule different than the current status quo, then let's document the status quo first, and then propose the change afterwards. That way we separate concerns and make it easier to move forward. Anyways, I'll put this on the agenda for the next BCD call. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, I wrote it to "test" the rules. So right now it reflects what I think the rules were, but not necessarily what they are. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> [!NOTE] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> If all browsers implemented worker support in their first implementation, then no subfeature would be required. It is only when any browser does something different that the subfeature is required. |
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.
Ca we use nested lists here, rather than a code block?