X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fattributes.js;h=73b4cdf116627f0bd490c7f1219c55d96e1b8bd9;hb=bca576550249e9b79b1097669dff6d4ddd0d65cf;hp=d2fc202b2fb7b50fd1d33be4bc9163b3bc84e0aa;hpb=392174431af1c9abc94ab6bd1c14f9f8f92a2a7d;p=jquery.git diff --git a/src/attributes.js b/src/attributes.js index d2fc202..73b4cdf 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 ) : @@ -339,3 +347,5 @@ jQuery.extend({ return jQuery.style( elem, name, value ); } }); + +})( jQuery );