Description
Select important-aware last declarations within one declaration list; no selector specificity, origin/layer cascade, shorthand expansion or value validity model.
CSS combines token syntax, property-specific value rules and layout/cascade processing. These are separate layers: splitting a declaration does not establish that its value is valid, and arithmetic on resolved lengths does not perform browser layout. Each tool here handles an explicit numeric representation or a stated lexical subset.
Select important-aware last declarations within one declaration list; no selector specificity, origin/layer cascade, shorthand expansion or value validity model.
When to use this tool
Use this tool to select important-aware last declarations within one declaration list; no selector specificity, origin/layer cascade, shorthand expansion or value validity model.
How to use the tool and how it works
- Enter text using the input definitions below.
- Run the operation. Resolve malformed-input errors before interpreting the result.
- Read result.winners. Interpret signs, units, ordering and null values using the rules below.
Parse the declaration list, preserving case-sensitive custom-property names and lowercasing ordinary names. For each first-seen name prefer important occurrences if any exist, then choose the last eligible occurrence and retain its declaration index/span.1, 2
| Input field | Meaning and units | Accepted input |
|---|---|---|
| text | CSS-subset text to parse under the operation’s stated grammar. | Text, at most 8,192 UTF-16 code units; the stated grammar and narrower limits also apply. |
| Output field | Interpretation |
|---|---|
| result | Object containing the fields below. |
| result.winners | First-seen property groups’ selected declaration records, retaining source spans and indexes. |
{
"input": {
"text": "a:1!important;a:2"
},
"output": {
"result": {
"winners": [
{
"name": "a",
"value": "1",
"important": true,
"start": 0,
"end": 13,
"index": 0
}
]
}
}
} Limitations and assumptions
- This resolves one declaration list only; selector specificity, cascade origin/layers, shorthands and property-value validity are not modeled.
- Lengths and times must already be resolved to consistent numeric units. Lexical helpers intentionally support smaller grammars than a full browser CSS parser; malformed supported-subset input causes an error.
- Every declared top-level input is required and unknown fields are rejected. Ordinary strings are limited to 8,192 UTF-16 code units and lists to 128 entries, with tighter operation-specific bounds where stated. JSON text has bounded nesting and node counts.
- Numeric outputs must be finite and within the absolute safe-integer magnitude; exact larger integers use decimal text. Source positions are zero-based UTF-16 offsets and span ends are exclusive unless a different convention is explicitly stated.
Alternative or Complementary methods
Use a full CSS parser or browser style/layout APIs when escape handling, error recovery, computed styles or the full cascade matter. These tools expose focused transformations and audits of supplied data.
References
Similar or alternative tools
- CSS Duplicate Property Table
Audit declaration property duplicates with ordinary ASCII property folding and case-sensitive custom-property names; not a cascade engine.
- CSS Important Suffix Formatter
Replace a top-level important suffix using an explicit flag without duplicating it; restricted comment-free balanced CSS values.