Skip to content

Conversation

@RobinMalfait
Copy link
Member

This PR will improve the matching of the length data type.

The issue is that we are basically validating if center_top_1rem is a valid data type. According to our definition, this is the case. The regex tests against (?:cm|mm|Q|in|pc|pt|px|em|ex|ch|rem|lh|vw|vh|vmin|vmax)$ and it happens to be that we end in 1rem which is valid.
However, this is not enough so we could potentially check that it also start with a number. But this will break examples where we have 1rem_2rem.

Instead, we will split by underscores (except if they are inside brackets [ and ]) and validate each part of it.
This should result in the fact that 1rem_2rem_3rem is valid, but center_1rem is not.

@RobinMalfait RobinMalfait merged commit b857d80 into master Dec 6, 2021
@RobinMalfait RobinMalfait deleted the improve-position-data-type branch December 6, 2021 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants