diff options
Diffstat (limited to 'js/vendor/jquery/src/attributes')
-rw-r--r-- | js/vendor/jquery/src/attributes/prop.js | 16 | ||||
-rw-r--r-- | js/vendor/jquery/src/attributes/val.js | 17 |
2 files changed, 28 insertions, 5 deletions
diff --git a/js/vendor/jquery/src/attributes/prop.js b/js/vendor/jquery/src/attributes/prop.js index da7bc1e86..e127bb08f 100644 --- a/js/vendor/jquery/src/attributes/prop.js +++ b/js/vendor/jquery/src/attributes/prop.js @@ -79,6 +79,12 @@ jQuery.extend( { } } ); +// Support: IE <=11 only +// Accessing the selectedIndex property +// forces the browser to respect setting selected +// on the option +// The getter ensures a default option is selected +// when in an optgroup if ( !support.optSelected ) { jQuery.propHooks.selected = { get: function( elem ) { @@ -87,6 +93,16 @@ if ( !support.optSelected ) { parent.parentNode.selectedIndex; } return null; + }, + set: function( elem ) { + var parent = elem.parentNode; + if ( parent ) { + parent.selectedIndex; + + if ( parent.parentNode ) { + parent.parentNode.selectedIndex; + } + } } }; } diff --git a/js/vendor/jquery/src/attributes/val.js b/js/vendor/jquery/src/attributes/val.js index 9999d985b..1fa91713d 100644 --- a/js/vendor/jquery/src/attributes/val.js +++ b/js/vendor/jquery/src/attributes/val.js @@ -4,7 +4,8 @@ define( [ "../core/init" ], function( jQuery, support ) { -var rreturn = /\r/g; +var rreturn = /\r/g, + rspaces = /[\x20\t\r\n\f]+/g; jQuery.fn.extend( { val: function( value ) { @@ -80,9 +81,15 @@ jQuery.extend( { option: { get: function( elem ) { - // Support: IE<11 - // option.value not trimmed (#14858) - return jQuery.trim( elem.value ); + var val = jQuery.find.attr( elem, "value" ); + return val != null ? + val : + + // Support: IE10-11+ + // option.text throws exceptions (#14686, #14858) + // Strip and collapse whitespace + // https://html.spec.whatwg.org/#strip-and-collapse-whitespace + jQuery.trim( jQuery.text( elem ) ).replace( rspaces, " " ); } }, select: { @@ -135,7 +142,7 @@ jQuery.extend( { while ( i-- ) { option = options[ i ]; if ( option.selected = - jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 + jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 ) { optionSet = true; } |