]> source.dussan.org Git - jquery.git/commitdiff
Make sure that missing attributes return undefined in Blackberry 4.7. Fixes #6938.
authorJohn Resig <jeresig@gmail.com>
Tue, 24 Aug 2010 14:28:47 +0000 (07:28 -0700)
committerJohn Resig <jeresig@gmail.com>
Tue, 24 Aug 2010 14:28:47 +0000 (07:28 -0700)
src/attributes.js

index d2fc202b2fb7b50fd1d33be4bc9163b3bc84e0aa..719c368af9f14e168d735a7ede4f3683a23d80fa 100644 (file)
@@ -325,6 +325,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 ) :