@@ -162,7 +162,7 @@ test("attr(Hash)", function() {
162
162
} ) ;
163
163
164
164
test ( "attr(String, Object)" , function ( ) {
165
- expect ( 69 ) ;
165
+ expect ( 73 ) ;
166
166
167
167
var div = jQuery ( "div" ) . attr ( "foo" , "bar" ) ,
168
168
fail = false ;
@@ -230,13 +230,20 @@ test("attr(String, Object)", function() {
230
230
jQuery ( "#name" ) . attr ( "maxLength" , "10" ) ;
231
231
equals ( document . getElementById ( "name" ) . maxLength , 10 , "Set maxlength attribute" ) ;
232
232
233
- var $text = jQuery ( "#text1" ) . attr ( "autofocus" , true ) ;
234
- if ( "autofocus" in $text [ 0 ] ) {
235
- equals ( $text . attr ( "autofocus" ) , "autofocus" , "Set boolean attributes to the same name" ) ;
236
- } else {
237
- equals ( $text . attr ( "autofocus" ) , undefined , "autofocus stays undefined in browsers that do not support it(F<4)" ) ;
238
- }
239
- equals ( $text . attr ( "autofocus" , false ) . attr ( "autofocus" ) , undefined , "Setting autofocus attribute to false removes it" ) ;
233
+ // HTML5 boolean attributes
234
+ var $text = jQuery ( "#text1" ) . attr ( {
235
+ "autofocus" : true ,
236
+ "required" : true
237
+ } ) ;
238
+ equal ( $text . attr ( "autofocus" ) , "autofocus" , "Set boolean attributes to the same name" ) ;
239
+ equal ( $text . attr ( "autofocus" , false ) . attr ( "autofocus" ) , undefined , "Setting autofocus attribute to false removes it" ) ;
240
+ equal ( $text . attr ( "required" ) , "required" , "Set boolean attributes to the same name" ) ;
241
+ equal ( $text . attr ( "required" , false ) . attr ( "required" ) , undefined , "Setting required attribute to false removes it" ) ;
242
+
243
+ var $details = jQuery ( "<details open></details>" ) . appendTo ( "#qunit-fixture" ) ;
244
+ equal ( $details . attr ( "open" ) , "open" , "open attribute presense indicates true" ) ;
245
+ equal ( $details . attr ( "open" , false ) . attr ( "open" ) , undefined , "Setting open attribute to false removes it" ) ;
246
+
240
247
equals ( $text . attr ( "data-something" , true ) . data ( "something" ) , true , "Setting data attributes are not affected by boolean settings" ) ;
241
248
equals ( $text . attr ( "data-another" , false ) . data ( "another" ) , false , "Setting data attributes are not affected by boolean settings" ) ;
242
249
equals ( $text . attr ( "aria-disabled" , false ) . attr ( "aria-disabled" ) , "false" , "Setting aria attributes are not affected by boolean settings" ) ;
0 commit comments