-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Deprecate index()'s false return value #1127
Comments
I've used a bit of "x == false" stuff in some cases where I care only about if something doesn't exist in a list. Given we can't (or shouldn't) do x == false, and x == null also throws a warning, what should we do? I can only really think of checking for a "positive" value, and then immediately following it with an |
Why can't you write |
You can - perfect! Thanks :) The warning from the compiler only suggested using Perhaps rather than throwing |
It's tough to get enough contextual information to figure out the perfect error message, unfortunately :-/. |
Actually, that error should just always say |
On failure index returns now null instead of false, but viewports always compares to false. This is easy to fix by taking a logical not of the resulting value. For more information see sass/sass#1127
79bad1f changed
index()
from returningfalse
when not finding an element to returningnull
. As discussed in #832, we didn't think this necessitated a deprecation process since we expected users to be writing@if index(...)
. However, it seems that at least Foundation explicitly checks againstfalse
.Rather than returning
null
immediately, we'll need to add aDeprecatedFalse
value that complains if it's used in a way that is incompatible with the futurenull
class.The text was updated successfully, but these errors were encountered: