Add a resetLonghands field to CSS shorthand properties#1872
Open
Add a resetLonghands field to CSS shorthand properties#1872
resetLonghands field to CSS shorthand properties#1872Conversation
Via #1851. Some shorthand properties may also reset a number of properties that they don't set. These properties are known as "reset-only sub-properties": https://drafts.csswg.org/css-cascade-5/#reset-only-sub-property This update adds a `resetLonghands` field in CSS extracts to shorthands that have reset-only sub-properties, leveraging the list maintained by @cdoublev in: https://github.com/cdoublev/css/blob/master/lib/properties/shorthands.js Affected properties: - `animation` (and the legacy `-webkit-animation`) - `background` - `border` - `font` - `mask` (and the legacy `-webkit-mask`) The list needs to be maintained manually, I'm afraid. I don't see any good way to extract the list of reset-only sub-properties automatically for now.
dontcallmedom
approved these changes
Mar 12, 2026
Member
dontcallmedom
left a comment
There was a problem hiding this comment.
LGTM, with a potential improvement (likely for a separate PR)
|
|
||
| const resetLonghands = getResetLonghands(prop, allProperties, propertiesByName); | ||
| if (resetLonghands && resetLonghands.length > 0) { | ||
| const validResetLonghands = resetLonghands.filter(lh => allProperties.has(lh)); |
Member
There was a problem hiding this comment.
this apply to the existing code, but shouldn't we fail or at least log an error of some sort if not all resetLonghands are valid?
Member
Author
There was a problem hiding this comment.
Yes, I aligned with the approach that exists for building the longhands field itself for consistency, but I agree that we should fail in both cases.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Via #1851. Some shorthand properties may also reset a number of properties that they don't set. These properties are known as "reset-only sub-properties": https://drafts.csswg.org/css-cascade-5/#reset-only-sub-property
This update adds a
resetLonghandsfield in CSS extracts to shorthands that have reset-only sub-properties, leveraging the list maintained by @cdoublev in:https://github.com/cdoublev/css/blob/master/lib/properties/shorthands.js
Affected properties:
animation(and the legacy-webkit-animation)backgroundborderfontmask(and the legacy-webkit-mask)The list needs to be maintained manually, I'm afraid. I don't see any good way to extract the list of reset-only sub-properties automatically for now.
Note: I haven't listed
animation-compositionas a reset-only sub-property foranimationyet, pending clarity on its inclusion, see #1851 (comment). To be determined before this PR is merged!