From 0ccc0811a2018156425eaac9549538fd71822e6b Mon Sep 17 00:00:00 2001 From: Florian Scholz Date: Thu, 8 Jun 2023 09:27:22 +0200 Subject: [PATCH] Add a guideline for static API members (#20048) --- docs/data-guidelines/api.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/docs/data-guidelines/api.md b/docs/data-guidelines/api.md index 7d0b5750d01b76..614d4eb7703785 100644 --- a/docs/data-guidelines/api.md +++ b/docs/data-guidelines/api.md @@ -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 `json() 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 `json() 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": "json() static method", + "support": {} + } + } + } + } +} +``` + +This guideline is based on a discussion in [#16613](https://github.com/mdn/browser-compat-data/issues/16613).