Exception thrown on float duration values
bartveneman opened this issue · 9 comments
- Webpack Version: N/A
- Operating System (or Browser):linux/amd64
- Node Version: node v10.15.2
- postcss-values-parser Version: 3.0.2
How Do We Reproduce?
Link to repl.it: https://repl.it/@bartveneman/postcss-values-parser-302-duration-errors
Expected Behavior
parse('.7s')
does not throw on time values that are floats
Actual Behavior
parse('.7s')
throws <css input>:1:1: Unknown word
Ah, s
as a unit. Can you link to the spec for other valid time-units?
- Level 2 https://www.w3.org/TR/CSS2/aural.html#times
- Level 3 https://drafts.csswg.org/css-values-3/#time
- Level 4 https://drafts.csswg.org/css-values-4/#time
Basically s
and ms
are allowed values. Level 2 defines that values may not be negative, but that note has disappeared from Level 3 onwards.
MDN provides examples with negative values, so might be useful to take that into consideration as well
Any time sheet when this issue will be fixed?
Should be compatible with https://drafts.csswg.org/css-values-4/#numeric-types right?
So just unitRegexp should be updated or is it necessary to make bigger changes?
https://github.com/shellscape/postcss-values-parser/blob/master/lib/nodes/Numeric.js#L17
@radeno that's probably what needs to be updated, and tests will need to be added as well. I would happily review a pull request for this.
I'd be happy to give this a try. Would it bu useful to append something like this to the test array and expand the regex until it doesn't fail?
'-5deg',
'5deg',
'5.5deg',
'-5.5deg',
'.5deg',
'-.5deg',
@bartveneman i tried to add angle values, but when 90deg was set then test fails. I don't have time to dig deeper. But time values support waits in PR.
Ah, sorry, I missed that reference above 😬
@shellscape Should this be closed? (by #87)
Indeed it should. Thanks for the heads up @glen-84 !