-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: properly check CSS length units
* Use regex for all CSS values Regression from #159 causes all rule values containing `vi` to be validated against `viewport-unit-variants`. Fixes #164
- Loading branch information
1 parent
2ad9e2b
commit 1275026
Showing
6 changed files
with
74 additions
and
53 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,8 @@ | ||
/** | ||
* Unit representing the width of the character "0" in the current font, of particular use in combination with monospace fonts. | ||
* | ||
* See: https://caniuse.com/ch-unit | ||
*/ | ||
import { checkCSSLengthUnits } from '../../utils/util.js'; | ||
|
||
/** | ||
* Unit representing the width of the character "0" in the current font, of particular use in combination with monospace fonts. | ||
* @see https://caniuse.com/ch-unit | ||
* @type {import('../features').Feature} | ||
*/ | ||
export default { | ||
'': 'ch', | ||
}; | ||
export default checkCSSLengthUnits('ch'); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
export default { | ||
'': [ | ||
'cqw', | ||
'cqh', | ||
'cqi', | ||
'cqb', | ||
'cqmin', | ||
'cqmax', | ||
], | ||
}; | ||
import { checkCSSLengthUnits } from '../../utils/util.js'; | ||
|
||
export default checkCSSLengthUnits( | ||
'cqw', | ||
'cqh', | ||
'cqi', | ||
'cqb', | ||
'cqmin', | ||
'cqmax', | ||
); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export default { | ||
'': 'rem', | ||
}; | ||
import { checkCSSLengthUnits } from '../../utils/util.js'; | ||
|
||
export default checkCSSLengthUnits('rem'); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,43 @@ | ||
import { checkCSSLengthUnits } from '../../utils/util.js'; | ||
|
||
/** | ||
* Small, Large, and Dynamic viewport units | ||
* Viewport units similar to `vw` and `vh` that are based on shown or hidden browser UI states to address shortcomings of the original units. Currently defined as the `sv*` units (`svb`, `svh`, `svi`, `svmax`, `svmin`, `svw`), `lv*` units (`lvb`, `lvh`, `lvi`, `lvmax`, `lvmin`, `lvw`), `dv*` units (`dvb`, `dvh`, `dvi`, `dvmax`, `dvmin`, `dvw`) and the logical `vi`/`vb` units. | ||
* Viewport units similar to `vw` and `vh` that are based on shown or hidden | ||
* browser UI states to address shortcomings of the original units. Currently | ||
* defined as the | ||
* `sv*` units (`svb`, `svh`, `svi`, `svmax`, `svmin`, `svw`), | ||
* `lv*` units (`lvb`, `lvh`, `lvi`, `lvmax`, `lvmin`, `lvw`), | ||
* `dv*` units (`dvb`, `dvh`, `dvi`, `dvmax`, `dvmin`, `dvw`) | ||
* and the logical `vi`/`vb` units. | ||
* @see https://caniuse.com/viewport-unit-variants | ||
*/ | ||
|
||
/** | ||
* @type {import('../features').Feature} | ||
*/ | ||
export default { | ||
'': [ | ||
/* sv* units */ | ||
'svb', | ||
'svh', | ||
'svi', | ||
'svmax', | ||
'svmin', | ||
'svw', | ||
export default checkCSSLengthUnits( | ||
/* sv* units */ | ||
'svb', | ||
'svh', | ||
'svi', | ||
'svmax', | ||
'svmin', | ||
'svw', | ||
|
||
/* lv* units */ | ||
'lvb', | ||
'lvh', | ||
'lvi', | ||
'lvmax', | ||
'lvmin', | ||
'lvw', | ||
/* lv* units */ | ||
'lvb', | ||
'lvh', | ||
'lvi', | ||
'lvmax', | ||
'lvmin', | ||
'lvw', | ||
|
||
/* dv* units */ | ||
'dvb', | ||
'dvh', | ||
'dvi', | ||
'dvmax', | ||
'dvmin', | ||
'dvw', | ||
/* dv* units */ | ||
'dvb', | ||
'dvh', | ||
'dvi', | ||
'dvmax', | ||
'dvmin', | ||
'dvw', | ||
|
||
/* vi/vb units */ | ||
'vi', | ||
'vb', | ||
], | ||
}; | ||
/* vi/vb units */ | ||
'vi', | ||
'vb', | ||
); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
expect: | ||
viewport-unit-variants: 0 | ||
*/ | ||
|
||
.test { | ||
visibility: visible; | ||
} |
This file contains 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