secondListNode.getElementById("title"), it find the element not in secondListNode but in secondListNode.ownDocument, you can see Mootools' code. In you example, secondListNode.ownDocument is the same as document, but in one page, id can't be reduplicated, so it will return null. In mootools' tutorial, element.getElementById() is a "Deprecate Method", so we should not use this method if possiple.(I've write an article about this problem, if you can read chinese, pls see http://www.gzool.com/viewtopic.php?f=12&t=19:) ) Regards, Gzool.
On Apr 15, 9:29 am, Mike <mickn...@gmail.com> wrote: > Thanks all for the replies. I think you are right. Probably safer to > use selectors. > > I guess it would be possible to iterate through all of the children of > the containing node to find the first node with that id.... but I > guess that's quite expensive. > > On Apr 15, 12:12 am, keif <god.dre...@gmail.com> wrote: > > > Dimitar: > > You're right to an extent. > > > For example, if you have: > > > <meta name="description"/> > > <ul id="description"> > > > $('description') in IE will grab the meta tag. > > > -kb > > > On Apr 14, 6:31 am, Dimitar Christoff <christ...@gmail.com> wrote: > > > > > I am not sure if (1) is a big deal since they are treated as strings. i > > > > oh, i thought it mattered for IE, the rule of thumb is to steer clear of > > > ids like name, description, title etc. > > > > for instance, <textarea name="description" id="description"></textarea> > > > in a doc with a <meta name="description" >, > > > document.getElementById("description") won't reference the textarea in > > > IE, if i remember correctly. > > > > hth, > > > Dimitar