Reserved ID Values?
Published 19 years, 2 months past
As a followup to my entry about id="tags"
causing problems in IE/Win, here are four five test pages for IE/Win:
- IE Keyword Testing (length)
- IE Keyword Testing (item)
- IE Keyword Testing (namedItem)
- IE Keyword Testing (tags)
- IE Keyword Testing (urns)
These are based on Kevin Hamilton’s observation that it’s highly likely the problems are caused by the tags
method in IE/Win’s document.all
DOM interface. As he says:
[I]f you have an element with an id=”tags”, then document.all.tags is now a reference to that element, and no longer a method of the document.all object.
Such states would completely shatter any IE DOM scripting that relied on the document.all
methods, and at least in the case of tags
causes problems like crashing on print (probably because of the aforementioned conflict between the ID value and the DOM method). The other keywords of concern are chronicled in the test pages listed above. I’d test IE/Win myself, except I don’t have a printer handy for IE/Win to use, and besides, bug-hunting is best conducted in large groups.
Basically, load up each test page in IE/Win and do anything you can think to do. Try to print, view source, save a local copy, et cetera, et cetera—the more obscure and offbeat, the better. Let us know via the comments any problems you run into with said pages (trying to print them is a good first step, since that’s what messed up on tags
) and I’ll add notes to each page based on what’s found.
In the meantime, I’m personally going to avoid using any of those words as ID values, and heartily recommend the same to you.
Update: I’ve added a test (for length
) to the above list, and have another that’s not on the list due to its unfinished nature. It’s a test of id="all"
; the problem is, I don’t really know how to test it, or if it’s likely to be a problem at all. Suggestions are welcomed in the comments. I added some JavaScript links to some of the test pages as a secondary test, but I’m not sure how much good they do, to be honest. As with suggestions, your feedback is welcome.
For those in search of more background, or trying to find new ways to test possible conflicts, or whatever, feel free to look over Microsoft’s documentation of the “all Collection”.