Mozilla and document.all, in the name of compatibility
The old certainties no longer hold. Browsers based on Gecko will soon
support the proprietary extension document.all. The unofficial press release came from Czilla in the article Document.all — limited support in Mozilla, subtitled “and why using document.all on the Internet is a bad idea.”
The announcement drew a response, but I couldn't find any commentary that addressed the change itself. I'll offer two perspectives on it.
From the user's point of view
Technical evangelism is one of the Mozilla project's aims, but what matters most to the project is happy users. These days it's hard to imagine a browser succeeding in direct proportion to how strictly it follows the rules, or standards. That's the first unfortunate thing. The second is that success or failure today is judged mainly by how many people use the browser.
For browsers outside the Internet Explorer family, sometimes derisively called “alternative browsers,” that “success” depends on how well they can handle proprietary DHTML extensions that Internet Explorer introduced in the name of progress. If the aim is to keep users happy, myself included, support for document.all can only be a good thing. Fewer pages will fail to work properly, and the browser will gain users.
From a user's point of view, top marks.
From an application's point of view
I praised the change from the user's perspective, but from the application's point of view I have criticisms. If Brendan Eich's team decided to expose document.all, they should have done it properly. Document.all doesn't behave the same in Mozilla as it does in Internet Explorer!
I understand this “hack” was aimed at end users, but the implementation of document.all could have gone further. As it stands, we got something that doesn't work properly, whether or not people ought to use it. Dozens or hundreds of inexperienced developers will run up against a harsh reality when they investigate the available but partially working document.all.
Want two examples that behave differently? Tested in Mozilla 1.8.3 alpha and IE 5.0 SP3.
function foo(){ alert(document.all["first"].length); }. . . <div id="first">xyz</div> <div id="first">xyz</div> function foo(){ alert(document.all.length); } . . . <div id="first">xyz</div> <div name="second">xyz</div>
I’m sure we could find much trickier cases, but I wasn’t trying to cover every incompatibility. I wanted to show that something that looks useful can turn out to be quite a trap. Of course, we can argue that document.all is just a workaround nobody will use. Either way, the old assumption that document.all doesn’t work in Mozilla no longer holds. Now we need ways to spot incompatibilities and point them out early.
Related articles
- (22.08.2004) Blog o tvorbě webu) Mozilla will support
- document.all
- (22.08.2004 About weblog) Mozi
- lla will display pages that use document.all
Related articles on Dagblog
Medium version · Archived original page
Related articles
Related CZ Podcast episodes
- #217 · Ivo Lukačovič
On Windy, JavaScript and building companies. · Czech audio
- #3 · Java 6 SE, Vývoj webových aplikací
Dagi and Filemon discuss Java 6 and web application frameworks. · Czech audio