diff options
author | Oleg Gaidarenko <markelog@gmail.com> | 2016-07-15 21:42:25 +0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-15 21:42:25 +0400 |
commit | e4fd41f8fa4190fbbb6cb98cf7ace64f6e00685d (patch) | |
tree | c9957f8e6da0b814dfd11a5d1d61d969f7be4efd /src/attributes/val.js | |
parent | 96966c022079e3956018717136367fbf4ed548a2 (diff) | |
download | jquery-e4fd41f8fa4190fbbb6cb98cf7ace64f6e00685d.tar.gz jquery-e4fd41f8fa4190fbbb6cb98cf7ace64f6e00685d.zip |
Build: Update eslint config and fix associated errors
Diffstat (limited to 'src/attributes/val.js')
-rw-r--r-- | src/attributes/val.js | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/attributes/val.js b/src/attributes/val.js index 1ba42a5c8..e23aa9a21 100644 --- a/src/attributes/val.js +++ b/src/attributes/val.js @@ -28,13 +28,13 @@ jQuery.fn.extend( { ret = elem.value; - return typeof ret === "string" ? - - // Handle most common string cases - ret.replace( rreturn, "" ) : + // Handle most common string cases + if ( typeof ret === "string" ) { + return ret.replace( rreturn, "" ); + } - // Handle cases where value is null/undef or number - ret == null ? "" : ret; + // Handle cases where value is null/undef or number + return ret == null ? "" : ret; } return; @@ -96,15 +96,19 @@ jQuery.extend( { }, select: { get: function( elem ) { - var value, option, + var value, option, i, options = elem.options, index = elem.selectedIndex, one = elem.type === "select-one", values = one ? null : [], - max = one ? index + 1 : options.length, - i = index < 0 ? - max : - one ? index : 0; + max = one ? index + 1 : options.length; + + if ( index < 0 ) { + i = max; + + } else { + i = one ? index : 0; + } // Loop through all the selected options for ( ; i < max; i++ ) { |