From 9ec429cf6270e455aba4eba85f4db80e633806b6 Mon Sep 17 00:00:00 2001 From: John Hoven Date: Thu, 6 Mar 2014 13:56:09 -0600 Subject: Attributes: Trim whitespace from option text when returned as a value Fixes #14858 Ref #14686 Closes gh-1531 --- src/attributes/val.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/attributes/val.js b/src/attributes/val.js index b13641b28..4a3b0e5c1 100644 --- a/src/attributes/val.js +++ b/src/attributes/val.js @@ -74,7 +74,9 @@ jQuery.extend({ var val = jQuery.find.attr( elem, "value" ); return val != null ? val : - jQuery.text( elem ); + // Support: IE10-11+ + // option.text throws exceptions (#14686, #14858) + jQuery.trim( jQuery.text( elem ) ); } }, select: { -- cgit v1.2.3