Skip to content

Commit

Permalink
Add a guideline for static API members (mdn#20048)
Browse files Browse the repository at this point in the history
  • Loading branch information
Elchi3 authored Jun 8, 2023
1 parent ba7a6b2 commit 0ccc081
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions docs/data-guidelines/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,3 +280,30 @@ For example, some attributes have moved from `Node` to `Attr` and `Element`. The
See [#9561](https://github.com/mdn/browser-compat-data/pull/9561) for a part of this data being fixed.

This guideline is based on a discussion in [#3463](https://github.com/mdn/browser-compat-data/issues/3463).

### Static API members

Always append the suffix `_static` to static members of an interface and have a description with text in the form of `<code>json()</code> static method`.

For example, the `Response` interface has both, a prototype and static method called `json()`. The static method is represented as `api.Response.json_static`. It has the description `<code>json()</code> static method`. The prototype method is represented as `api.Response.json` without suffix and without description.

```json
{
"api": {
"Response": {
"__compat": {},
"json": {
"__compat": {}
},
"json_static": {
"__compat": {
"description": "<code>json()</code> static method",
"support": {}
}
}
}
}
}
```

This guideline is based on a discussion in [#16613](https://github.com/mdn/browser-compat-data/issues/16613).

0 comments on commit 0ccc081

Please sign in to comment.