Hacker News new | past | comments | ask | show | jobs | submit login

Has been like this for as long as I can remember (at least back to IE6).



Yup - in fact there's an old bug that jQuery (in versions < 2, I believe) accounts for where IE would return elements with a name equal to the id you're searching for as the underlying system there was all wonky.

e.g:

    <input name="test">
    <div id="test">

    document.getElementById('test'); // <input> in IE6
I believe this also wound up in some Webkit and Opera releases, perhaps for emulation. Someone more knowledgeable about it all should feel free to correct me if I'm wrong though.

(Edited for code formatting, I don't comment too much these days)




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: