You're right. This could also be done with a ternary operation. Something like:

 $(this).attr("class") || ""