3.7.06

Unscathed

This is one of those aha's that I didn't have to find out myself. While minding my own business I came across this dude's blog article on IE, createElement and the name attribute.

In a nutshell, and reusing a quote from MSDN:

The NAME attribute cannot be set at run time on elements dynamically created with the createElement method. To create an element with a name attribute, include the attribute and value when using the createElement method.

Do read the article, because it's pointless for me to paraphrase it. However, I do have a comment and this goes in general: instead of using document.all, I'd rather test the issue itself. Do whatever works in all other browsers, then test if it worked, and execute the exception if it didn't. In this case, it obviously means you'll have to use more lines of code.

How long your code will stick around and what other functions or libraries you use will dictate which method is preferred. If there is a chance that a script enables document.all for other browsers, or your "fix" will be hard to find among thousands of lines of code when upgrades give you trouble, the option will be evident.

No comments: