Skip to content

Commit fdd78fa

Browse files
committed
Attrs: Remove outdated valHook for option element
This hook was relevant for BlackBerry 4.7 which is no longer supported. But this code path now raises error in IE10-11 (#14686) in 1.x-master branch. So to just to be safe, also add test for IE issue to this branch too.
1 parent 38c122a commit fdd78fa

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/attributes/val.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,6 @@ jQuery.fn.extend({
7171

7272
jQuery.extend({
7373
valHooks: {
74-
option: {
75-
get: function( elem ) {
76-
// attributes.value is undefined in Blackberry 4.7 but
77-
// uses .value. See #6932
78-
var val = elem.attributes.value;
79-
return !val || val.specified ? elem.value : elem.text;
80-
}
81-
},
8274
select: {
8375
get: function( elem ) {
8476
var value, option,

test/unit/attributes.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,3 +1445,12 @@ test( "coords returns correct values in IE6/IE7, see #10828", function() {
14451445
area = map.html("<area shape='rect' coords='0,0,0,0' href='#' alt='a' />").find("area");
14461446
equal( area.attr("coords"), "0,0,0,0", "did not retrieve coords correctly" );
14471447
});
1448+
1449+
test( "should not throw at $(option).val() (#14686)", 1, function() {
1450+
try {
1451+
jQuery( "<option/>" ).val();
1452+
ok( true );
1453+
} catch ( _ ) {
1454+
ok( false );
1455+
}
1456+
});

0 commit comments

Comments
 (0)