Core: Standardize indexOf comparisons

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

Closes gh-1984
This commit is contained in:
Richard Gibson
2014-12-31 18:31:27 -05:00
parent 4cbf02df84
commit 53aa87f3bf
8 changed files with 12 additions and 11 deletions

View File

@@ -240,7 +240,7 @@ jQuery.event = {
return;
}
if ( type.indexOf(".") >= 0 ) {
if ( type.indexOf(".") > -1 ) {
// Namespaced trigger; create a regexp to match event type in handle()
namespaces = type.split(".");
type = namespaces.shift();
@@ -438,7 +438,7 @@ jQuery.event = {
if ( matches[ sel ] === undefined ) {
matches[ sel ] = handleObj.needsContext ?
jQuery( sel, this ).index( cur ) >= 0 :
jQuery( sel, this ).index( cur ) > -1 :
jQuery.find( sel, this, null, [ cur ] ).length;
}
if ( matches[ sel ] ) {