diff options
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++ ) { |