diff options
author | Richard Gibson <richard.gibson@gmail.com> | 2014-12-31 18:31:27 -0500 |
---|---|---|
committer | Richard Gibson <richard.gibson@gmail.com> | 2015-01-10 23:56:39 -0500 |
commit | 6ae222a54f687e7950a3f4c4e04bd42ca0387504 (patch) | |
tree | 375d91bf1579deebf18309e1222bcdbafdb8953a /src/attributes/val.js | |
parent | 18baae2efb36a6c759c0dddac7d25da9c554dff7 (diff) | |
download | jquery-6ae222a54f687e7950a3f4c4e04bd42ca0387504.tar.gz jquery-6ae222a54f687e7950a3f4c4e04bd42ca0387504.zip |
Core: Standardize indexOf comparisons
not present: `< 0`
present: `> -1`
at index: `=== N`
(cherry picked from commit 53aa87f3bf4284763405f3eb8affff296e55ba4f)
Closes gh-1985
Diffstat (limited to 'src/attributes/val.js')
-rw-r--r-- | src/attributes/val.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/attributes/val.js b/src/attributes/val.js index 6adf8e2d2..2a6ccab3d 100644 --- a/src/attributes/val.js +++ b/src/attributes/val.js @@ -128,7 +128,7 @@ jQuery.extend({ while ( i-- ) { option = options[ i ]; if ( (option.selected = - jQuery.inArray( jQuery.valHooks.option.get( option ), values ) >= 0) ) { + jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1) ) { optionSet = true; } } @@ -149,7 +149,7 @@ jQuery.each([ "radio", "checkbox" ], function() { jQuery.valHooks[ this ] = { set: function( elem, value ) { if ( jQuery.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); + return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) > -1 ); } } }; |