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

@@ -25,7 +25,8 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
"url" :
typeof s.data === "string" &&
!( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") &&
( s.contentType || "" )
.indexOf("application/x-www-form-urlencoded") === 0 &&
rjsonp.test( s.data ) && "data"
);

View File

@@ -24,7 +24,7 @@ jQuery.fn.load = function( url, params, callback ) {
self = this,
off = url.indexOf(" ");
if ( off >= 0 ) {
if ( off > -1 ) {
selector = jQuery.trim( url.slice( off ) );
url = url.slice( 0, off );
}