79bad1f changed index() from returning false when not finding an element to returning null. 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 against false.
Rather than returning null immediately, we'll need to add a DeprecatedFalse value that complains if it's used in a way that is incompatible with the future null class.
Make index() return a DeprecatedFalse object rather than null.
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 @else. But that seems kludgy.
Why can't you write @if not x?
@if not x
You can - perfect! Thanks :) The warning from the compiler only suggested using @if x, hence why I was trying to figure a way around it.
Perhaps rather than throwing For example, instead of "@if index(...) == false", just write
"@if index(...)". it could suggest @if not index(...) instead if that makes sense? (That message was from the Sass compiler in CodeKit 2).
For example, instead of "@if index(...) == false", just write
@if not index(...)
It's tough to get enough contextual information to figure out the perfect error message, unfortunately :-/.
Actually, that error should just always say @if not index(...). I'll fix that.
Fix the index function use to work with new Sass versions.
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