Core: Standardize indexOf comparisons

not present: `< 0`
present: `> -1`
at index: `=== N`

(cherry picked from commit 53aa87f3bf)

Closes gh-1985
This commit is contained in:
Richard Gibson
2014-12-31 18:31:27 -05:00
parent 18baae2efb
commit 6ae222a54f
7 changed files with 11 additions and 10 deletions

View File

@@ -76,7 +76,7 @@ jQuery.fn.extend({
j = 0;
while ( (clazz = classes[j++]) ) {
// Remove *all* instances
while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
cur = cur.replace( " " + clazz + " ", " " );
}
}
@@ -149,7 +149,7 @@ jQuery.fn.extend({
l = this.length;
for ( ; i < l; i++ ) {
if ( this[i].nodeType === 1 &&
(" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
(" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
return true;
}