[Moo] Re: Question about .getElementById()

2009-04-14 Thread Gzool
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' tutor

[Moo] Re: Question about .getElementById()

2009-04-14 Thread Mike
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 wrote: > Dimitar:

[Moo] Re: Question about .getElementById()

2009-04-14 Thread keif
Dimitar: You're right to an extent. For example, if you have: $('description') in IE will grab the meta tag. -kb On Apr 14, 6:31 am, Dimitar Christoff 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

[Moo] Re: Question about .getElementById()

2009-04-14 Thread Fábio Costa
id="length" won't work either, because of that node mapping, it will bug. document.forms[0].length ?!?! got it? Fábio Miranda Costa Engenheiro de Computação http://meiocodigo.com On Tue, Apr 14, 2009 at 7:31 AM, Dimitar Christoff wrote: > > > I am not sure if (1) is a big deal since they ar

[Moo] Re: Question about .getElementById()

2009-04-14 Thread Dimitar Christoff
> 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, in a doc with a , document.getElementById("description") won't reference the textarea in IE, i

[Moo] Re: Question about .getElementById()

2009-04-13 Thread nwhite
I am not sure if (1) is a big deal since they are treated as strings. it shouldn't matter. (2) is the issue. Maybe use 'class' instead of 'id'? then you could do something: $('list1').getElement('.title').get('html'); notice the .get() instead of innerHTML. more of the moo way of doing things.

[Moo] Re: Question about .getElementById()

2009-04-13 Thread Fábio Costa
1 - You should not use id="title" or any other attribute name; 2 - You should not use the same id on more than one element (id=identifier, i.e. sould be unique). Fábio Miranda Costa Engenheiro de Computação http://meiocodigo.com On Mon, Apr 13, 2009 at 8:45 PM, Mike wrote: > > When I try to