mirror of
https://github.com/jquery/jquery.git
synced 2024-12-09 08:04:24 +00:00
Use prop to retrieve boolean properties (so the selected hook will be used)
This commit is contained in:
parent
ec829431fe
commit
6f676e692d
@ -466,7 +466,7 @@ jQuery.extend({
|
||||
boolHook = {
|
||||
get: function( elem, name ) {
|
||||
// Align boolean attributes with corresponding properties
|
||||
return elem[ jQuery.propFix[ name ] || name ] ?
|
||||
return jQuery.prop( elem, name ) ?
|
||||
name.toLowerCase() :
|
||||
undefined;
|
||||
},
|
||||
|
@ -40,7 +40,7 @@ test("jQuery.attrFix/jQuery.propFix integrity test", function() {
|
||||
});
|
||||
|
||||
test("attr(String)", function() {
|
||||
expect(37);
|
||||
expect(38);
|
||||
|
||||
equals( jQuery("#text1").attr("type"), "text", "Check for type attribute" );
|
||||
equals( jQuery("#radio1").attr("type"), "radio", "Check for type attribute" );
|
||||
@ -92,6 +92,12 @@ test("attr(String)", function() {
|
||||
|
||||
body.removeAttribute("foo"); // Cleanup
|
||||
|
||||
var select = document.createElement("select"), optgroup = document.createElement("optgroup"), option = document.createElement("option");
|
||||
optgroup.appendChild( option );
|
||||
select.appendChild( optgroup );
|
||||
|
||||
equal( jQuery( option ).attr("selected"), "selected", "Make sure that a single option is selected, even when in an optgroup." );
|
||||
|
||||
var $img = jQuery("<img style='display:none' width='215' height='53' src='http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif'/>").appendTo("body");
|
||||
equals( $img.attr("width"), "215", "Retrieve width attribute an an element with display:none." );
|
||||
equals( $img.attr("height"), "53", "Retrieve height attribute an an element with display:none." );
|
||||
|
Loading…
Reference in New Issue
Block a user