Re-adding the test from @Sebmaster
Fix hasAttribute to be case-insensitive

Fixes #431.
Add a comment on why the hasAttribute code does this