Skip to content

refactor (v11): Improve accuracy of non-dimensional regex #4772

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compat/src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ export function shallowDiffers(a, b) {
}

export const IS_NON_DIMENSIONAL =
/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;
/^(-|f[lo].*[^se]$|g.{5,}[^ps]$|z|o[pr]|(W.{5})?[lL]i.*(t|mp)$|an|(bo|s).{4}Im|sca|m.{6}[ds]|ta|c.*[st]$|wido|ini)/;
Copy link
Member

@JoviDeCroock JoviDeCroock May 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My main concern here is that this is a significant byte size increase for something that I'm not sure is worth it because style doesn't feel that widely used

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I don't love it, I figure if we are going to offer this (which we're probably stuck with), it should be correct. Intentionally not supporting ~1/4 of the properties we should feels a bit bad for 47b in compat.

I don't have strong opinions either way though, can't say I even recall using style recently myself.

19 changes: 12 additions & 7 deletions compat/test/browser/render.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -800,10 +800,12 @@ describe('compat render', () => {
// Our appending logic must not be applied here
const untouched = {
'-webkit-line-clamp': 2,
animation: 2,
'animation-iteration-count': 3,
'border-image': 2,
'border-image-slice': 2,
'column-count': 2,
// TODO: unsupported atm
// columns: 2,
columns: 2,
flex: 1,
'flex-grow': 1,
'flex-shrink': 1,
Expand All @@ -814,21 +816,24 @@ describe('compat render', () => {
'grid-column-start': 2,
'grid-row': 2,
'grid-row-end': 2,
'grid-row-gap': 23,
'grid-row-start': 2,
// TODO: unsupported atm
//'line-height': 2,
'inital-letter': 2,
'line-height': 2,
'line-clamp': 2,
'mask-border': 2,
'mask-border-outset': 2,
'mask-border-slice': 2,
'mask-border-width': 2,
'max-lines': 2,
'max-zoom': 2,
'min-zoom': 2,
opacity: 123,
order: 123,
orphans: 2,
'grid-row-gap': 23,
scale: 23,
// TODO: unsupported atm
//'tab-size': 23,
'shape-image-threshold': 23,
'tab-size': 23,
widows: 123,
'z-index': 123,
zoom: 123
Expand Down
Loading