Waiting for JavaScript... (any day now)

A Tale of the Forbidden

There is a DOM property, which can be used, but not seen; undefined but accessible; transient, yet present from the beginning of time.

For sanity of the denizens of the world, the creators of this aberration now purposefully shun it, bravely trying to hide its existence from any script foolish enough to look for it.

I am of course talking about document.all. It is a relic from the days before a standardized DOM API, a chaotic age when it was every browser for itself. To support DHTML, IE4 created document.all, which provided a list (or function) by which a script could access an element by its ID, similar to how document.getElementById() would later work.

It was never to become part of the standard DOM, and as such, initially no other browsers attempted to replicate this obsolete feature. Yet, so many websites would come to rely on it; in its idiomaticity, it became a reliable way to test whether the user agent was Internet Explorer.

This presented a problem for the developers of Firefox: how to provide its functionality without making scripts think that they were running on IE? The solution was even hackier than document.all itself: the browser JS engine would pretend as if it did not exist. The result of a boolean test or comparison would be as if the property were undefined, but it would actually be accessible. This made it such that scripts which used its presence to check if the browser was IE would not be led astray, but scripts which simply assumed that that was the case would not be disappointed.

This behavior became so accepted, it would eventually make its way into the HTML standard itself, as an extension beyond the DOM. At first, its bizarre attributes were admitted as a "willing violation" of the ECMAScript language, but the ES standard itself would later make a formal provision for such objects by means of the [[isHTMLDDA]] internal slot, which stands for "is HTML Document Dot All".