A quick question about event management. I have a button that toggles
a style field on certain elements between two different values and
here's the code that I use:

function firstFunction(event) {
  $$("div[class='content']").invoke("setStyle",{height:"50px"});
  $$("input[value='height toggle']")[0].stopObserving('click');
  function secondFunction(event) {
    $$("div[class='content']").invoke("setStyle",{height:"100px"});
    $$("input[value='height toggle']")[0].stopObserving('click');
    $$("input[value='height toggle']")
[0].observe('click',firstFunction);
  };
  $$("input[value='height toggle']")
[0].observe('click',secondFunction);
};

Basically what I do is toggle between two function on the same button
by having one set up the observer for the other by first clearing all
the other observers, a lot like a mutually recursive set of functions
and I'm wondering if there is a better way of doing this because I
know javascript is prone to memory leaks and I'm trying to avoid them.

-- 
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-scriptacul...@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