Bug Tracker

Changeset 5683

Show
Ignore:
Timestamp:
05/24/08 18:09:21 (6 months ago)
Author:
aflesler
Message:

jquery core: closes #2930. Normalizing attr() to return undefined, even when getting DOM attributes.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/jquery/src/core.js

    r5682 r5683  
    10611061 
    10621062            // If applicable, access the attribute via the DOM 0 way 
    1063             if ( notxml && !special && name in elem ) { 
     1063            if ( name in elem && notxml && !special ) { 
    10641064                if ( set ){ 
    10651065                    // We can't allow the type property to be changed (since it causes problems in IE) 
     
    10841084                elem.setAttribute( name, "" + value ); 
    10851085 
    1086             if ( msie && special && notxml ) 
    1087                 return elem.getAttribute( name, 2 ); 
    1088  
    1089             return elem.getAttribute( name ); 
    1090  
     1086            var attr = msie && notxml && special 
     1087                    // Some attributes require a special call on IE 
     1088                    ? elem.getAttribute( name, 2 ) 
     1089                    : elem.getAttribute( name ); 
     1090 
     1091            // Non-existent attributes return null, we normalize to undefined 
     1092            return attr === null ? undefined : attr; 
    10911093        } 
    10921094