You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Demonstrate JSON Schema as source of truth for web-features data (#2990)
* Add move and split redirects to the schema (#3000)
* Add guidelines for moving and splitting features (#3180)
* Add consumer docs for moved and split features (#3181)
* Change schema `string | string[]` properties to `string[]` (#3184)
* Fix missing `group` and `snapshot` keys from convenience types
Co-authored-by: James C Scott III <7788930+jcscottiii@users.noreply.github.com>
Co-authored-by: Philip Jägenstedt <philip@foolip.org>
Co-authored-by: Patrick Brosset <patrickbrosset@gmail.com>
Co-authored-by: szepeviktor <952007+szepeviktor@users.noreply.github.com>
Co-authored-by: LeoMcA <755354+LeoMcA@users.noreply.github.com>
Co-authored-by: foolip <498917+foolip@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/guidelines.md
+76-1Lines changed: 76 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,6 +77,81 @@ The identifier should match the name, with these additional guidelines:
77
77
- 👍 Recommended: `user-pseudos`
78
78
- 👎 Not recommended: `user-valid-and-user-invalid`
79
79
80
+
### Move a feature to a new ID
81
+
82
+
It’s possible to change or substitute a feature’s ID by creating a redirect from the original ID pointing to a new ID.
83
+
You can do this when:
84
+
85
+
* The original feature ID is misspelled.
86
+
For example, `numeric-seperators` (note spelling) data can be moved to `numeric-separators`.
87
+
88
+
* The original feature ID breaks the identifier guidelines.
89
+
For example, `drones-initial-support` data can be moved to `drones`.
90
+
91
+
* The original feature should not have existed as an independent feature.
92
+
For example, `single-color-gradients` was a poorly-conceived feature, where [a specification change](https://github.com/w3c/csswg-drafts/issues/10092) simplified the specification, implementation, and tools, but produced no novel browser behavior that developers could use in an application.
93
+
Instead, all the compatibility keys for the feature were reassigned to `gradients`.
94
+
95
+
* Data consumers report that the original feature ID is confusing or misleading.
96
+
97
+
You must not do this when the feature has been superseded, such that the feature's name has changed and the exposed behaviors or API surface have changed (in shipping browsers, up to and including unshipping).
98
+
Instead, use [`discouraged` data](#discouraged) with one or more `alternatives`.
99
+
100
+
To move the feature:
101
+
102
+
1. If applicable, move the existing YAML files for the feature to the target ID filename.
103
+
For example, rename `features/numeric-seperators.yml` to `features/numeric-separators.yml`.
104
+
105
+
If the original feature is being replaced by another feature, then move on to the next step.
106
+
107
+
2. Create a new YAML file for the original target ID filename.
108
+
For example, create an empty file `features/numeric-seperators.yml`.
109
+
110
+
3. Populate the following data in the new YAML file:
111
+
112
+
```yaml
113
+
kind: moved
114
+
redirect_target: TARGET-ID
115
+
```
116
+
117
+
where `TARGET-ID` is the target ID.
118
+
119
+
4. Regenerate the dist files.
120
+
Run `npm run dist`.
121
+
122
+
5. Commit your work and open a pull request.
123
+
124
+
### Split a feature into two or more other features
125
+
126
+
Some features may need to be split in two or more parts.
127
+
You can do this when the original feature should not have existed as an independent feature in the first place.
128
+
For example, similarly-named compat keys that ought to have been additions to existing features were erroneously combined and assigned to a new feature.
129
+
130
+
To split the feature:
131
+
132
+
1. If the feature to be split has any keys listed in `compat_features`, then reassign the keys to the target features.
133
+
134
+
To get the list of keys, you may need to first run `npm run undist -- $feature` where `$feature` is the path to the YAML file of the feature to be split.
135
+
136
+
2. Replace the contents of the original feature YAML file with the following data:
137
+
138
+
```yaml
139
+
kind: split
140
+
redirect_targets:
141
+
- target-id1
142
+
- target-id2
143
+
```
144
+
145
+
Replace the `target-id` values with two or more target ID strings.
146
+
Order `redirect_targets` by the most widely-relevant features first.
147
+
For example, if the feature is split to separate a Baseline subset of a feature from a non-Baseline subset, then put the Baseline feature first.
148
+
If you must break a tie, use alphabetical order.
149
+
150
+
3. Regenerate the dist files.
151
+
Run `npm run dist`.
152
+
153
+
4. Commit your work and open a pull request.
154
+
80
155
## Descriptions
81
156
82
157
The `description` field contains a short description of the feature in Markdown-formatted text, which is converted to HTML in the published package.
@@ -345,6 +420,6 @@ When you set a `discouraged` block in a feature file, do:
345
420
If possible, use the single most broadly applicable reference, such as specification text.
346
421
If a feature is removed from a specification, link to an issue, pull request, or commit showing the removal.
347
422
348
-
- Set one or more (optional) `alternative` feature IDs that are whole or partial substitutes for the discouraged feature.
423
+
- Set one or more (optional) `alternatives` feature IDs that are whole or partial substitutes for the discouraged feature.
349
424
An alternative doesn't have to be a narrow drop-in replacement for the discouraged feature but it must handle some use case of the discouraged feature.
350
425
Guide developers to the most relevant features that would help them stop using the discouraged feature.
description: To improve readability for numeric literals, underscores (`_`) can be used as separators. For example, `1_050.95` is equivalent to `1050.95`.
0 commit comments