- From: Maciej Stachowiak <mjs@apple.com>
- Date: Sun, 28 Jan 2007 14:58:51 -0800
- To: Boris Zbarsky <bzbarsky@mit.edu>
- Cc: Robert Sayre <sayrer@gmail.com>, Anne van Kesteren <annevk@opera.com>, Bjoern Hoehrmann <derhoermi@gmx.net>, Simon Pieters <zcorpan@gmail.com>, "public-webapi@w3.org" <public-webapi@w3.org>
On Jan 27, 2007, at 7:56 PM, Boris Zbarsky wrote: > > Robert Sayre wrote: >> MSDN says it returns the "first object". >> <http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/ >> getelementbyid.asp> > > For what it's worth, that's not what Gecko does, and I personally > would rather not try to enforce that -- it's somewhat expensive to > do so in the face of DOM mutations. I tried to make some test cases to figure out the difference (in current WebKit sources we changed to return the first match in document order to match IE, and, we thought, Firefox), but Gecko's getElementById seems to be really buggy. For instance, this alerts null: <div id="foo"> </div> <script> alert(document.getElementById("foo")); </script> This is with Firefox 2.0.0.1 on Mac OS X. What am I doing wrong here? Regards, Maciej
Received on Sunday, 28 January 2007 22:59:29 UTC