I Was Tripped Up By the Most Asinine Bug in Microsoft Internet Explorer, Bar None

After much poking at a Javascript-generated table for my day job, wondering why Internet Explorer insisted on ignoring the colspan attribute on a <td> element, I ran across this.

Thus, one must use <td colSpan="2">...</td> in order for it to work as intended in Internet Explorer, which breaks XHTML 1.0, and, for that matter, every other browser.

What’s worse: this bug persists in Internet Explorer 7.0.

Screenshots:

Before

After

Update: This bug is deep inside of Internet Explorer’s implementation of the DOM. It turns out that constructing a static web page using colspan as an attribute normally works just fine, but if you are using JavaScript to generate the table using the DOM, it wants to use the camelCase version as an attribute. Madness!

MochiKit already has a section of code to work around this, in DOM.js:

// for braindead browsers (IE) that insert extra junk
.
.
.
attributeArray.renames = {
     "class": "className",
     "checked": "defaultChecked",
     "usemap": "useMap",
     "for": "htmlFor"
}; 

Looks like an easy patch.

2006.10.25 · permalink