Attrs: Fix valHook for option element

Fixes #14686
This commit is contained in:
Oleg 2014-01-16 02:05:57 +04:00
parent a3cd88f14b
commit 92cbf5362c
2 changed files with 10 additions and 2 deletions

View File

@ -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: {

View File

@ -1448,3 +1448,12 @@ test( "coords returns correct values in IE6/IE7, see #10828", function() {
area = map.html("<area shape='rect' coords='0,0,0,0' href='#' alt='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( "<option/>" ).val();
ok( true );
} catch ( _ ) {
ok( false );
}
});