-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Guards, numbers and units #1180
Comments
(2) & (3) it would make sense I think to ignore units if one doesn't have units, otherwise always return false, so I agree |
I found another asymmetry in equals operator handling: 4.) The equals Example input:
compiles into:
Expected output:
This does not match description "Guards, numbers and units", but seems to be related. |
I've fixed the regression (1) (2) & (3) need more thought so am deferring for a later release as I think it is workable in its current state, if not consistent. |
Btw, (2) & (3) were fixed in 1.7.0 so I guess this can be closed? |
Makes sense. Any idea if 4 is fixed too? |
Ah, I've overlooked the (4). Nope, it is not fixed... I guess that's just because unlike other cases this one compares different types, i.e. Btw, but the same applies to any type except
I.e. we probably can make one universal compare function for all of those types, but the escaped
|
Closing as case (4) is fixed in v2. |
Hi, I found three issues on guards units handling.
1.) The equals
=
operator does not compare numbers with the same units. Expression4px=4px
is evaluated as false.Example:
compiles into:
expected output:
2.) The equals
=
operator both can and can not compare unitless numbers with units. Expression4px=4
is evaluated as true, but4=4px
is false.Example input:
compiles into:
expected output:
3.) Operators '<', '<=', '>', '>=' ignore units entirely. The expression
3%>=2px
evaluates to true. Equals '=' on numbers with different units evaluate to false.Example:
compiles into:
expected output:
Tested on less-1.4.0-alpha.js and less-1.3.3.js.
The text was updated successfully, but these errors were encountered: