return value;
}
- } else if ( hooks && "get" in hooks && notxml ) {
- return hooks.get( elem, name );
+ } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
+ return ret;
} else {
// Use the formHook for button elements in IE6/7 (#1954)
jQuery.attrHooks.value = {
get: function( elem, name ) {
+ var ret;
if ( formHook && jQuery.nodeName( elem, "button" ) ) {
return formHook.get( elem, name );
}
return name in elem ?
elem.value :
- elem.getAttribute( name );
+ null;
},
set: function( elem, value, name ) {
if ( formHook && jQuery.nodeName( elem, "button" ) ) {
});
test("attr(String)", function() {
- expect(43);
+ expect(45);
equals( jQuery("#text1").attr("type"), "text", "Check for type attribute" );
equals( jQuery("#radio1").attr("type"), "radio", "Check for type attribute" );
ok( jQuery("<div/>").attr("title") === undefined, "Make sure undefined is returned when no attribute is found." );
equal( jQuery("<div/>").attr("title", "something").attr("title"), "something", "Set the title attribute." );
ok( jQuery().attr("doesntexist") === undefined, "Make sure undefined is returned when no element is there." );
+ equal( jQuery("<div/>").attr("value"), undefined, "An unset value on a div returns undefined." );
+ equal( jQuery("<input/>").attr("value"), "", "An unset value on an input returns current value." );
});
if ( !isLocal ) {