Daniel,
this is a copy of current Prototype "firstDescendant" modified to fit.

  lastDescendant: function(element) {
    element = $(element).lastChild;
    while (element && element.nodeType != 1) element =
element.previousSibling;
    return $(element);
  },

Isn't this what you need ?

Diego


On 11 Gen, 15:02, "Varga-Háli Dániel" <vargada...@gmail.com> wrote:
> Hello,
>
> I have added a simple enhancement to the prototype lib (v1.6.0) which
> can be used to get the last childnode of element:
>
>     lastDescendant: function(element) {
>         var descs = $(element).descendants();
>         var iterator = 1;
>         element = descs[descs.length-iterator];
>         while(element && element.nodeType != 1 && iterator <= descs.length) {
>             iterator++;
>             element = descs[descs.length-iterator];
>         }
>         return $(element);
>     }
>
> With syntax highlighting it is available here:http://pastebin.com/f5918ff36
>
> I hope some of you will find it useful. :)
>
> Regards,
> Daniel Varga, Hungary
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to 
prototype-core-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to