Skip to content
0:00 / 0:00

#document.all#internetexplorer#dom

Weird JavaScript Object Only 0.01% Know About!

Strangest Code

14 subscribers • 1 video on Hallway

YouTube
  • Recommended by 1 person: 1 on Stack Overflow and its sister sites.

Intermediate. Assumes working knowledge.

317 views3 years ago1 recommendation

Programming languagesWeb developmentJavaScriptHow browsers workHTTP, REST and GraphQL

An explanation of the historical reasons behind the bizarre behavior of document.all in modern web browsers.

I discovered a JavaScript object that behaves like an object and like undefined at the same time! This object is document.all! In this video, we will see the weird behavior of document.all and why it came to be like this. (As you might have guessed, this has something to do with Internet Explorer!) Is document.all the weirdest object in JavaScript? I think so. Let me know if you agree in the comments below! Bugzilla bugs shown in the video: - Internet Explorer (document.all) Compatibility (bug id: 74201) - implement Internet Explorer DOM features document.all and others. (bug id: 154589) Attributions: - Old Firefox logo by Mozilla Corporation, MPL 1.1 - Browser Wars chart by Wereon - Own work based on: Browser Wars.png, CC BY-SA 3.0. (The title was removed and the colors were modified to appear nice on a dark background.) - HTML5 logo by W3C, CC BY 3.0 - New Firefox logo by Mozilla Corporation, MPL 2 - Edge logo by Microsoft Corporation, MIT

Why it's here

1 person recommends this

What people say. Recommended for its historical perspective on why document.all exists and behaves as a falsy object in modern browsers.

cute_ptron Stack Overflow • Recommends

On “Why is document.all falsy?”

The other answers already give a good explanation of why document.all behaves the way it does. However, I was very curious to know more about the historical perspective. Where does document.all come from and why do modern browsers support it to this day? So, I did some research to learn more about it, and here's what I found. document.all was originally introduced in Internet Explorer 4. It's main use was to access elements by ID, like this: var element = document.allid Later, the W3C standardized document.getElementById as a way to get elements by their ID. However, since IE had the biggest market share for many years, many websites just kept using document.all without testin…