This was a feature implemented in IE (presumably as a syntax sugar to avoid peppering your code with getElementById() in the long ago days before frameworks, I'm talking 1999).
Originally, other browsers such as Netscape didn't have this misfeature. But at some point some non-IE browsers started to implement this feature to be compatible with corporate websites that uses IE specific features.
I'm not entirely sure but I believe by now this is specified in some standard (either ECMAScript or HTML5 or something else). So now all browsers implement this "feature".