@@ -247,7 +247,7 @@ test( "attr(Hash)", function() {
247
247
} ) ;
248
248
249
249
test ( "attr(String, Object)" , function ( ) {
250
- expect ( 67 ) ;
250
+ expect ( 71 ) ;
251
251
252
252
var div = jQuery ( "div" ) . attr ( "foo" , "bar" ) ,
253
253
i = 0 ,
@@ -281,7 +281,14 @@ test( "attr(String, Object)", function() {
281
281
equal ( $input . attr ( "name" ) , "something" , "Check element creation gets/sets the name attribute." ) ;
282
282
equal ( $input . attr ( "id" ) , "specified" , "Check element creation gets/sets the id attribute." ) ;
283
283
284
- // As of fixing #11115, we make no promises about the effect of .attr on boolean properties
284
+ // As of fixing #11115, we only guarantee boolean property update for checked and selected
285
+ $input = jQuery ( "<input type='checkbox'/>" ) . attr ( "checked" , true ) ;
286
+ equal ( $input . prop ( "checked" ) , true , "Setting checked updates property (verified by .prop)" ) ;
287
+ equal ( $input [ 0 ] . checked , true , "Setting checked updates property (verified by native property)" ) ;
288
+ $input = jQuery ( "<option/>" ) . attr ( "selected" , true ) ;
289
+ equal ( $input . prop ( "selected" ) , true , "Setting selected updates property (verified by .prop)" ) ;
290
+ equal ( $input [ 0 ] . selected , true , "Setting selected updates property (verified by native property)" ) ;
291
+
285
292
$input = jQuery ( "#check2" ) ;
286
293
$input . prop ( "checked" , true ) . prop ( "checked" , false ) . attr ( "checked" , true ) ;
287
294
equal ( $input . attr ( "checked" ) , "checked" , "Set checked (verified by .attr)" ) ;
0 commit comments