IE, it's a bastard, but what can we do?

Beware of get/setAttribute

In the W3C DOM, setAttribue() accepts a string value, and getAttribute() returns a string value.

In IE, setAttribute() will store the passed value as is, rather than coerce into a string.

eg. if you setAttribute('blah', 0) it will be returned as a number by getAttribute('blah').

So be careful when doing:
 if (elem.getAttribute('blah')) ...

If only they had implemented hasAttribute()!