From: Oleg Date: Wed, 15 Jan 2014 22:05:57 +0000 (+0400) Subject: Attrs: Fix valHook for option element X-Git-Tag: 1.11.0-rc1~6 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=92cbf5362cfe4fe52e919eecfebe8ecbe27ee5e3;p=jquery.git Attrs: Fix valHook for option element Fixes #14686 --- diff --git a/src/attributes/val.js b/src/attributes/val.js index 8454e80d0..16296a631 100644 --- a/src/attributes/val.js +++ b/src/attributes/val.js @@ -71,11 +71,10 @@ jQuery.extend({ valHooks: { option: { get: function( elem ) { - // Use proper attribute retrieval(#6932, #12072) var val = jQuery.find.attr( elem, "value" ); return val != null ? val : - elem.text; + jQuery.text( elem ); } }, select: { diff --git a/test/unit/attributes.js b/test/unit/attributes.js index 8ba2b4459..2b2eee425 100644 --- a/test/unit/attributes.js +++ b/test/unit/attributes.js @@ -1448,3 +1448,12 @@ test( "coords returns correct values in IE6/IE7, see #10828", function() { area = map.html("a").find("area"); equal( area.attr("coords"), "0,0,0,0", "did not retrieve coords correctly" ); }); + +test( "should not throw at $(option).val() (#14686)", 1, function() { + try { + jQuery( "