document.all
is a proprietary feature of Microsoft Internet Explorer; a JavaScript-accessible collection of all page elements and precursor to the W3C document.getElementById()
method.
Firefox doesn't support document.all
. Or does it?
Beware: Firefox does sport a document.all
when a page is in quirks mode. In fact, you can see it with the DOM Inspector tool. It doesn't have any child elements so I suspect it's some sort of wrapper for getElementById
. Try referencing it from code and you may get this friendly warning:
Warning: Non-standard document.all property was used. Use W3C standard document.getElementById() instead.
Switch to a standards-compliant page and document.all
is undefined, as expected.
Obviously this puts code that employs quick old-school browser checking with document.all
at risk — especially if your code is meant to be portable or drop-in. Updated: see below.
Update: looks like support for document.all was introduced in Moz 1.7.5 back in December 2004.
Update #2 Confusion. The Mozillazine note says the document.all is "undetectable", but the way I discovered this was because FF was taking an IE code path based on the existence of document.all, exactly what shouldn't be happening. So I dunno.
Update #3 I haven't been able to reproduce the case that led me to discover Firefox's document.all
implementation, so I think the bug must have been in my code. (Shocking, I know!) In any case, it does look like a test for document.all
in Firefox should return false.