@layer revert-layer Cascade Order Lookup
Resolve revert-layer within caller ordered declared layers, importance reverses layer order; origin/unlayered/specificity competition must already be resolved externally. Explicit supplied computed/layout context only; not a browser cascade/layout engine or cross-browser guarantee.
Description
Cascade layers have ordering rules that differ for normal and important declarations.
Cascade layers have ordering rules that differ for normal and important declarations.1
A supplied rollback trace does not execute the complete cascade across origins and declarations. Use @layer revert-layer Cascade Order Lookup to evaluate the supplied inputs under the specific model below.
When to use @layer revert-layer Cascade Order Lookup
Use @layer revert-layer Cascade Order Lookup to evaluate the supplied inputs under the specific model below. Define the supplied layout, token or rendering scenario and establish the relevant units and browser context independently.
How to use @layer revert-layer Cascade Order Lookup and understand its results
- Define the supplied layout, token or rendering scenario and establish the relevant units and browser context independently.
- Enter Caller ordered layer names, Caller winning tokens, Current layer index, Important declaration using the field table and validation rules below, then run the tool.
- Read Resolved prior layer token, Selected layer index and interpret units, signs, ordering and placeholders as explained below.
- If the tool reports an input error, correct that field and rerun. A successful false result, empty match list or unknown-evidence placeholder has the specific meaning described here; check the limitations before applying the result.
| Input field | Meaning | Value type | Requirement |
|---|---|---|---|
| callerOrderedLayerNames | Caller ordered layer names | array of string | Required; constraints below |
| callerWinningTokens | Caller winning tokens | array of string | Required; constraints below |
| currentLayerIndex | Current layer index | number | Required; constraints below |
| importantDeclaration | Important declaration | boolean | Required; constraints below |
Enter unique nonblank layer IDs, aligned winning-token strings, a valid zero-based current-layer index containing exactly revert-layer and an important-declaration flag. Normal declarations search toward decreasing layer indices; important declarations search toward increasing indices. Skip additional revert-layer tokens and return the first ordinary supplied token. Exhausting the supplied layers is an error. The caller must supply the correct layer order and preselected layer winners; unlayered rules, origins and full cascade competition are outside the model.
step = important ? +1 : −1; winner = first non-revert-layer token reached from currentIndex+step Field order, units and branch conditions follow the implementation explanation above.
| Output field | Meaning | Value type |
|---|---|---|
| resolvedPriorLayerToken | Resolved prior layer token | string |
| selectedLayerIndex | Selected layer index | number |
{
"input": {
"callerOrderedLayerNames": [
"base",
"theme",
"local"
],
"callerWinningTokens": [
"black",
"blue",
"revert-layer"
],
"currentLayerIndex": 2,
"importantDeclaration": false
},
"output": {
"resolvedPriorLayerToken": "blue",
"selectedLayerIndex": 1
}
} Limitations and assumptions
Layer priority reverses for important declarations. The local search direction here assumes layer winners and order have already been established.2
A supplied rollback trace does not execute the complete cascade across origins and declarations. Apply the exact scope and assumptions described above.
All listed fields require explicit values. Unexpected fields, incorrect types, nonfinite numbers and sparse arrays fail validation. Domain-specific bounds, alignments and supported tokens are stated above; extremely large inputs or outputs can also be rejected. These errors differ from successful results such as false, no matches or unknown evidence.
Alternative or Complementary methods
Use inherit/initial/unset/revert Resolution Table for a related task: CSS-wide keywords choose parent, initial or rollback values under defined rules.
Use contain Strictness Levels Lookup for a related task: Containment separates selected effects on layout, painting, sizing and style.
References
Similar or alternative tools
- inherit/initial/unset/revert Resolution Table
CSS-wide keywords choose parent, initial or rollback values under defined rules.
- contain Strictness Levels Lookup
Containment separates selected effects on layout, painting, sizing and style.