Hi Simon,

you should use event delmeguation so that, you first only set one
observer, and then you can freely modify the DOM and still access to
your event.

--
david

On 27 oct, 09:55, "T.J. Crowder" <t...@crowdersoftware.com> wrote:
> Hi Simon,
>
> > ...do I need to stopObserving those events before
> > replacing the elements.
>
> Yes, otherwise a variety of things do indeed sit around in memory.
>
> HTH,
> --
> T.J. Crowder
> Independent Software Consultant
> tj / crowder software / comwww.crowdersoftware.com
>
> On Oct 26, 7:07 pm, Simon <simon.hagst...@gmail.com> wrote:
>
> > If I observe events on elements that I later replace with new elements
> > with innerHTML, do I need to stopObserving those events before
> > replacing the elements. I guess I'm mostly concerned about memory
> > leakage. E.g:
>
> > <div id="inputs">
> >         <input type="text" name="input1" /> ... <input type="text"
> > name="input100" />
> > </div>
>
> > $('inputs').select('input').invoke('observe', 'blur', function()
> > {...});
>
> > $('inputs').innerHTML = '<input type="text" name="input101" /> ...
> > <input type="text" name="input200" />';
>
> > $('inputs').select('input').invoke('observe', 'blur', function()
> > {...});
>
> > Thanks
> > Simon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to