On Oct 3, 11:19 am, rfd <[EMAIL PROTECTED]> wrote:
> Hi ,
>
> I have been trying to extend prototype's DOM extensions to a
> collection of radio button inputs with no success whatsoever.
>
> Here is the code:
> --------------------------------------------------
> var profiles = Form.getInputs("Form1", "radio", "supporter_id");
>
> profiles.each ( function(node)
> {
>         Event.observe ( node, 'click', function ()
>         {
>
>                 var tds = this.up(1).immediateDescendants();

Because when you attach event listeners this way, the value of the
function's this keyword is set differently in IE than most other
browsers.  In IE, it will be the window object, in others it will be
the element that the listener is attached to.

You pass node to the function, so use it.  You may also find that
using the cells collection is quicker than getting the immediate
desecendants (though you may not notice that).

   var tds = node.up(1).cells;

It uses the DOM cells collection rather than Prototype's iteration
over child nodes.

You may also find that you have memory leaks in IE due to closures and
circular references, but that may not matter.


--
Rob


--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to