I get the Event.unloadCache but let's say you have something like this:

<div id="test">
</div>

script is:
Event.observe('test', 'click', function(){ alert('I am so happy') })

Your Event.observers.length is 1

then you want to remove test, so before you actually remove it from the
dom you are kind enough to say,
"hey, test div, stop observing that click and go have a beer"

Event.stopObserving('test', 'click', function(){ alert('I am so happy')
})

You would think that observer would have beer and get out of the
Event.observers array so length would equal Zero.

But it doesn't, so I complain. So now the Event.unloadCache() cycles
through observer objecst  that don't exist anymore which doesn't seem
right.
Also, I don't think that hard to fix just put after line

      element.removeEventListener(name, observer, useCapture);
      this.observers.pop([element, name, observer, useCapture]);

and

        element.detachEvent('on' + name, observer);
        this.observers.pop([element, name, observer, useCapture]);

Just my 2 cents.

> Basically, Event.observers is a 'behind-the-scenes' type of element
> and you really don't even need to worry about it at all. It's tempting
> to want to keep Event.observers clean and up to date with your current
> observational model, but this is a mistake and will just end up being
> a frustration in the long run.
>
> -E
>
> On 12/13/06, heidmotron <[EMAIL PROTECTED]> wrote:
>
>
>
> > Just wondering why Event.stopObserving() doesn't remove the itself from
> > the Event.obervers array?
> 
> > Is there a reason for this?--
> Eric Ryan Harrison


--~--~---------~--~----~------------~-------~--~----~
 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