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

Add metadata documentation #2547

Merged
merged 13 commits into from
May 28, 2020
Next Next commit
Create metadata.md
  • Loading branch information
Markel committed Apr 27, 2020
commit f05cc8bd32bb5dda8a552fca05aee6e3df6e879c
48 changes: 48 additions & 0 deletions metadata.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Metadata
At the top of every feature detect in Modernizr there is a JSON fragment that represents the metadata of the test. This data is used to build the webpage, for example.
This is an example of this schema and does not represent a real test:
## Schema
```json
/*!
{
"name": "JPEG 2000",
"property": "jpeg2000",
"tags": ["media", "attribute"],
"caniuse": "jpeg2000",
"authors": ["Markel Ferro (@MarkelFe)", "@rejas", "Brandom Aaron"],
"builderAliases": ["a_download"],
"polyfills": ["xaudiojs"],
"aliases": ["jpeg-2000", "jpg2"],
"async": true,
"warnings": ["These tests currently require document.body to be present"],
"knownBugs": ["This will false positive in IE6"],
"notes": [{
"name": "Specification",
"href": "https://www.w3.org/"
}, {
"name": "Github issue",
"href": "https://github.com/Modernizr/"
}]
}
!*/
/* DOC
Here it would go a description of the feature test. You can use **markdown** here :)
*/
```
> There is no set order in which they must appear, but it is common to see `name` and `property` at the top while `notes` at the bottom.

## Item description
| | Necesity | Description | Notes |
|------------------|:--------:|:----------------------------------------------------:|:--------------------------------------------------:|
| `name` | required | Name of the feature detection | |
| `property` | required | The property name established in `Modernizr.addTest` | Preferably just lowercase, without any punctuation |
| `tags` | optional | | |
| `caniuse` | optional | | |
| `authors` | optional | List of contributors of the script | There are a couple of ways to express it |
| `builderAliases` | optional | | |
| `polyfills` | optional | Available polyfills for not working versions | Add them in lib/polyfills.json |
| `aliases` | optional | Other names that the feature goes by | Used for search |
| `async` | optional | If the test supports async functionality | Defaults to false |
| `warnings` | optional | Notes to the developer using the script | Don't mistake it for knownBugs |
| `knownBugs` | optional | Bugs known of the test (e.g.: doesn't work in IE6) | |
| `notes` | optional | Links to resources | |