X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fattributes.js;h=4fa49b914169a90af85fa579867ed8ed32c80690;hb=20673d7e5836dda504b66730b528a8dae9787493;hp=d2fc202b2fb7b50fd1d33be4bc9163b3bc84e0aa;hpb=392174431af1c9abc94ab6bd1c14f9f8f92a2a7d;p=jquery.git diff --git a/src/attributes.js b/src/attributes.js index d2fc202..4fa49b9 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -1,3 +1,5 @@ +(function( jQuery ) { + var rclass = /[\n\t]/g, rspace = /\s+/, rreturn = /\r/g, @@ -325,6 +327,12 @@ jQuery.extend({ elem.setAttribute( name, "" + value ); } + // Ensure that missing attributes return undefined + // Blackberry 4.7 returns "" from getAttribute #6938 + if ( !elem.attributes[ name ] && !elem.hasAttribute( name ) ) { + return undefined; + } + var attr = !jQuery.support.hrefNormalized && notxml && special ? // Some attributes require a special call on IE elem.getAttribute( name, 2 ) : @@ -333,9 +341,7 @@ jQuery.extend({ // Non-existent attributes return null, we normalize to undefined return attr === null ? undefined : attr; } - - // elem is actually elem.style ... set the style - // Using attr for specific style information is now deprecated. Use style instead. - return jQuery.style( elem, name, value ); } }); + +})( jQuery );