I suppose this is totally obvious to Javascript pundits, but I only recently noticed after banging my head against the wall that Internet Explorer does not support setting the class attribute of a newly created DOM element by using

element.setAttribute("class", "some-class-name");
    

Instead one has to use

element.className = "some-class-name";
    

I find this behaviour rather strange, especially when considering that the semantic meaning of the class attribute is no different than the meaning of other attributes. But if one wants their code to work on IE, the bottom line is that they'll have to live with this inconsistency.

And now let's hope Google picks this up, and people who share my debugging pain find this.

Written on 2006-01-19 19:01:23.