-
Notifications
You must be signed in to change notification settings - Fork 47.9k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add missing unitless CSS properties #19286
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,9 @@ | |
* CSS properties which accept numbers but are not in units of "px". | ||
*/ | ||
export const isUnitlessNumber = { | ||
animation: true, | ||
animationIterationCount: true, | ||
borderImage: true, | ||
borderImageOutset: true, | ||
borderImageSlice: true, | ||
borderImageWidth: true, | ||
|
@@ -24,6 +26,7 @@ export const isUnitlessNumber = { | |
flexShrink: true, | ||
flexNegative: true, | ||
flexOrder: true, | ||
fontSizeAdjust: true, | ||
gridArea: true, | ||
gridRow: true, | ||
gridRowEnd: true, | ||
|
@@ -34,11 +37,19 @@ export const isUnitlessNumber = { | |
gridColumnSpan: true, | ||
gridColumnStart: true, | ||
fontWeight: true, | ||
initialLetter: true, | ||
lineClamp: true, | ||
lineHeight: true, | ||
maskBorder: true, | ||
maskBorderOutset: true, | ||
maskBorderSlice: true, | ||
maskBorderWidth: true, | ||
maxLines: true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This property isn't standardize and I think has been superseded by There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That’s right, I just wanted to add any property with a status of standard or experimental. |
||
opacity: true, | ||
order: true, | ||
orphans: true, | ||
scale: true, | ||
shapeImageThreshold: true, | ||
tabSize: true, | ||
widows: true, | ||
zIndex: true, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one looks wrong to me. I assume it refers to the "duration" or "delay" parts of the shorthand? Looking at the
animation-duration
docs, it says:The
animation-delay
docs say the same:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit hidden under the grammar for
animation
:<time> || <easing-function> || <time> || <single-animation-iteration-count> || <single-animation-direction> || <single-animation-fill-mode> || <single-animation-play-state> || [ none | <keyframes-name> ]
where<single-animation-iteration-count>
is valid syntax which can be a single number.Reproducible in chrome:

--https://codesandbox.io/s/animation-unitless-mg06t
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Thank you for clarifying.
I'm still concerned that changing
animation
may be a bad idea, since the majority of the numeric values this shorthand property covers do require units.Then again, as I've mentioned elsewhere on this PR, this is not my area of expertise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since
animation: 1px
is meaningless/invalid, I don’t think addinganimation
can break anything, at least (except if perhaps someone has a unitless number that gets px and thus ignored today).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'm not familiar with this part of the code, so I don't know what the implications of adding this rule for a shorthand property that can contain multiple numeric values. I agree
animation: 1px
is meaningless though 😆