I want to have children of an ul. With Firefox it works well but IE
says that the ul hasn''t this porperty.
the code :
var divGroup = $(friendGroupBlockId + groupID);
var ulGroup = divGroup.getElementsByTagName(''ul'')[0];
var list = ulGroup.immediateDescendants();
var listLength = list.length;
var before = list[listLength-1];
// var newFriendElement = new Insertion.Before(before,
newFriendStr);
before.insert({before : newFriendStr}, true);
PS: I use prototype 1.6.0_rc0
Why doesn''t IE recognize immediateDescendants ?
Thanks for your help
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
Because you are using "getElementsByTagName". The problem is IE
can''t extend
all HTMLElements (adding methods like immediateDescendants), you have to
extend each of them yourself. In firefox/safari/etc this is not the case, so
this works (because all htmlelements are automatically extended by
Prototype).
You could do it with (untested):
$(friendGroupBlockId + groupID).down("ul li:last-child").insert({
before:
newFriendString });
Element.down (http://prototypejs.org/api/element#method-down) will go down
the DOM tree to select the last <li> children of an <ul> element
inside the
friendGroup, and then you can just insert before that one.
best,
Nicolas
On 10/22/07, choupigore
<aurelien.baudet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
>
> I want to have children of an ul. With Firefox it works well but IE
> says that the ul hasn''t this porperty.
>
> the code :
> var divGroup = $(friendGroupBlockId + groupID);
> var ulGroup = divGroup.getElementsByTagName
> (''ul'')[0];
> var list = ulGroup.immediateDescendants();
> var listLength = list.length;
> var before = list[listLength-1];
>
> // var newFriendElement = new Insertion.Before
> (before,
> newFriendStr);
> before.insert({before : newFriendStr}, true);
>
> PS: I use prototype 1.6.0_rc0
>
> Why doesn''t IE recognize immediateDescendants ?
>
> Thanks for your help
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
Thank you for your help. It works great!! On 22 oct, 19:51, "Nicolás Sanguinetti" <godf...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Because you are using "getElementsByTagName". The problem is IE can''t extend > all HTMLElements (adding methods like immediateDescendants), you have to > extend each of them yourself. In firefox/safari/etc this is not the case, so > this works (because all htmlelements are automatically extended by > Prototype). > > You could do it with (untested): > > $(friendGroupBlockId + groupID).down("ul li:last-child").insert({ before: > newFriendString }); > > Element.down (http://prototypejs.org/api/element#method-down) will go down > the DOM tree to select the last <li> children of an <ul> element inside the > friendGroup, and then you can just insert before that one. > > best, > Nicolas > > On 10/22/07, choupigore <aurelien.bau...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I want to have children of an ul. With Firefox it works well but IE > > says that the ul hasn''t this porperty. > > > the code : > > var divGroup = $(friendGroupBlockId + groupID); > > var ulGroup = divGroup.getElementsByTagName > > (''ul'')[0]; > > var list = ulGroup.immediateDescendants(); > > var listLength = list.length; > > var before = list[listLength-1]; > > > // var newFriendElement = new Insertion.Before > > (before, > > newFriendStr); > > before.insert({before : newFriendStr}, true); > > > PS: I use prototype 1.6.0_rc0 > > > Why doesn''t IE recognize immediateDescendants ? > > > Thanks for your help--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---