mirror of
https://github.com/jquery/jquery.git
synced 2026-04-20 03:01:22 -04:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user