return value;
}
};
-
- // Retrieving the width/height attributes on an
- // element with display: none returns 0 in ie6/7 (#5413)
- jQuery.each([ "width", "height" ], function( i, name ) {
- jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
- get: function( elem ) {
- var ret;
- jQuery.swap( elem, { visibility: "hidden", display: "block" }, function() {
- ret = elem.getAttribute( name );
- });
- return ret;
- }
- });
- });
}
// Remove certain attrs if set to false
// Some attributes require a special call on IE
if ( !jQuery.support.hrefNormalized ) {
- jQuery.each([ "href", "src", "style" ], function( i, name ) {
+ jQuery.each([ "href", "src", "style", "width", "height", "list" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
get: function( elem ) {
return elem.getAttribute( name, 2 );
<select name="D4" disabled="disabled">
<option selected="selected" value="NO">NO</option>
</select>
+ <input id="list-test" type="text" />
+ <datalist id="datalist">
+ <option value="option"></option>
+ </datalist>
</form>
<div id="moretests">
<form>
});
test("attr(String)", function() {
- expect(30);
+ expect(31);
equals( jQuery('#text1').attr('type'), "text", 'Check for type attribute' );
equals( jQuery('#radio1').attr('type'), "radio", 'Check for type attribute' );
jQuery('<a/>').attr({ 'id': 'tAnchor5', 'href': '#5' }).appendTo('#main');
equals( jQuery('#tAnchor5').attr('href'), "#5", 'Check for non-absolute href (an anchor)' );
+ // list attribute is readonly by default in browsers that support it
+ jQuery("#list-test").attr("list", "datalist");
+ equals( jQuery("#list-test").attr("list"), "datalist", "Check setting list attribute" );
+
// Related to [5574] and [5683]
var body = document.body, $body = jQuery(body);