notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
// Normalize the name if needed
- name = notxml && jQuery.attrFix[ name ] || name;
+ if ( notxml ) {
+ name = jQuery.attrFix[ name ] || name;
- hooks = jQuery.attrHooks[ name ];
+ hooks = jQuery.attrHooks[ name ];
- if ( !hooks ) {
- // Use boolHook for boolean attributes
- if ( rboolean.test( name ) ) {
+ if ( !hooks ) {
+ // Use boolHook for boolean attributes
+ if ( rboolean.test( name ) ) {
- hooks = boolHook;
+ hooks = boolHook;
- // Use formHook for forms and if the name contains certain characters
- } else if ( formHook && name !== "className" &&
- (jQuery.nodeName( elem, "form" ) || rinvalidChar.test( name )) ) {
+ // Use formHook for forms and if the name contains certain characters
+ } else if ( formHook && name !== "className" &&
+ (jQuery.nodeName( elem, "form" ) || rinvalidChar.test( name )) ) {
- hooks = formHook;
+ hooks = formHook;
+ }
}
}
var ret, hooks,
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
- // Try to normalize/fix the name
- name = notxml && jQuery.propFix[ name ] || name;
-
- hooks = jQuery.propHooks[ name ];
+ if ( notxml ) {
+ // Fix name and attach hooks
+ name = jQuery.propFix[ name ] || name;
+ hooks = jQuery.propHooks[ name ];
+ }
if ( value !== undefined ) {
if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
if ( !isLocal ) {
test("attr(String) in XML Files", function() {
- expect(2);
+ expect(3);
stop();
jQuery.get("data/dashboard.xml", function( xml ) {
- equals( jQuery( "locations", xml ).attr("class"), "foo", "Check class attribute in XML document" );
- equals( jQuery( "location", xml ).attr("for"), "bar", "Check for attribute in XML document" );
+ equal( jQuery( "locations", xml ).attr("class"), "foo", "Check class attribute in XML document" );
+ equal( jQuery( "location", xml ).attr("for"), "bar", "Check for attribute in XML document" );
+ equal( jQuery( "location", xml ).attr("checked"), "different", "Check that hooks are not attached in XML document" );
start();
});
});