tmort / Socialite

Other
1.68k stars 163 forks source link

Using trim to ensure don't space-creep on removeClass. #26

Closed IDisposable closed 12 years ago

IDisposable commented 12 years ago

(not sure this is right, I'm a js noob)

dbushell commented 12 years ago

Thanks for updating, but I don't we can do String.prototype.trim(' text '). My bad!

Thinking about it further I'd suggest this:

trim: function(str)
{
    return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g,'');
},

place it after settings = { }, is define. Makes no difference but I'm being picky :)

I just noticed line 39 is missing an opening parenthesis, it should be socialite.trim(( — alternatively you could remove the closing one here: ).replace, e.g:

el.className = socialite.trim(' ' + el.className + ' '.replace(' ' + cn + ' ', ' '));

That should do it!

IDisposable commented 12 years ago

Done. Sorry, I typoed the edit, I'm a git.