stopObserving

I just came across this today and it looks solid. However, on an initial inspection of the code I noticed that stopObserving is being used incorrectly. In each case, it is just being called with a simple invoke. That will not work; the exact function provided to observe must also be provided to stopObserving.

Now, right after stopObserving is invoked, the elements are removed. I have never been able to find a clear review of how well browsers clean up after themselves when elements are removed, but theoretically it should get rid of the event then anyway.

But, to be precise, stopObserving should be used like this:

this.bfx = this.fx.bindAsEventListener(this);
elt.observe('click', obj.bfx);
elt.stopObserving('click', obj.bfx);

Thanks for the fix!

jamiegrove's picture

Thanks for the fix. We're kind of in hibernation here but when we awake and begin coding again, I'll make sure to correct that.

- Jamie

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options