From: Brandon Aaron Date: Sat, 21 Jul 2007 01:55:05 +0000 (+0000) Subject: addClass doesn't fail when passed an undefined or null variable (#1309) X-Git-Tag: 1.1.4~46 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=480aae72d3fe7c10eb51e310b88acc37c34f8bd8;p=jquery.git addClass doesn't fail when passed an undefined or null variable (#1309) --- diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index 741b13b53..d6d3d6a2d 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -1365,7 +1365,7 @@ jQuery.extend({ className: { // internal only, use addClass("class") add: function( elem, c ){ - jQuery.each( c.split(/\s+/), function(i, cur){ + jQuery.each( (c || "").split(/\s+/), function(i, cur){ if ( !jQuery.className.has( elem.className, cur ) ) elem.className += ( elem.className ? " " : "" ) + cur; });