From a87ecc44b6b4374ad2ebe10e033d45daab9e1369 Mon Sep 17 00:00:00 2001 From: John Resig Date: Sat, 20 Jan 2007 03:58:57 +0000 Subject: [PATCH] Added a fix for $("#noexist").attr("id") breaking. --- src/jquery/jquery.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index 085b576..4e82608 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -429,7 +429,7 @@ jQuery.fn = jQuery.prototype = { // Look for the case where we're accessing a style value if ( key.constructor == String ) if ( value == undefined ) - return jQuery[ type || "attr" ]( this[0], key ); + return this.length && jQuery[ type || "attr" ]( this[0], key ) || undefined; else { obj = {}; obj[ key ] = value; -- 1.7.10.4