mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
addClass doesn't fail when passed an undefined or null variable (#1309)
This commit is contained in:
parent
b965c98ff1
commit
480aae72d3
2
src/jquery/jquery.js
vendored
2
src/jquery/jquery.js
vendored
@ -1365,7 +1365,7 @@ jQuery.extend({
|
|||||||
className: {
|
className: {
|
||||||
// internal only, use addClass("class")
|
// internal only, use addClass("class")
|
||||||
add: function( elem, c ){
|
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 ) )
|
if ( !jQuery.className.has( elem.className, cur ) )
|
||||||
elem.className += ( elem.className ? " " : "" ) + cur;
|
elem.className += ( elem.className ? " " : "" ) + cur;
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user