From 7b3ab69fcfd5a53d7084bbe4b19a7f3e58d8564d Mon Sep 17 00:00:00 2001 From: John Resig Date: Sat, 20 Jan 2007 04:16:25 +0000 Subject: [PATCH] Fixed issue with .add()ing individual elements - and with .add()ing form elements (since they report a .length. --- src/jquery/jquery.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index 4e82608..38c8da3 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -985,7 +985,10 @@ jQuery.fn = jQuery.prototype = { add: function(t) { return this.pushStack( jQuery.merge( this.get(), - typeof t == "string" ? jQuery(t).get() : t.length ? t : [t] ) + t.constructor == String ? + jQuery(t).get() : + t.length != undefined && !t.nodeName ? + t : [t] ) ); }, -- 1.7.10.4