aboutsummaryrefslogtreecommitdiffstats
path: root/src/attributes/val.js
diff options
context:
space:
mode:
authorRichard Gibson <richard.gibson@gmail.com>2014-12-31 18:31:27 -0500
committerRichard Gibson <richard.gibson@gmail.com>2015-01-10 23:47:01 -0500
commit53aa87f3bf4284763405f3eb8affff296e55ba4f (patch)
treeaa6731b18465d87fbd0f1b93a33cdb1e59a5d04e /src/attributes/val.js
parent4cbf02df84dbcaa44b75a64ed832f7dbff2231dd (diff)
downloadjquery-53aa87f3bf4284763405f3eb8affff296e55ba4f.tar.gz
jquery-53aa87f3bf4284763405f3eb8affff296e55ba4f.zip
Core: Standardize indexOf comparisons
not present: `< 0` present: `> -1` at index: `=== N` Closes gh-1984
Diffstat (limited to 'src/attributes/val.js')
-rw-r--r--src/attributes/val.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/attributes/val.js b/src/attributes/val.js
index c5e8c63f4..1bb9072e6 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;
}
}
@@ -148,7 +148,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 );
}
}
};