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…