Tests for attr() with fix for $.isObject() and fix for conditions in attr() itself

Apologies, this also stripped some trailing whitespace. I hope you don't mind that.

Fixes #349