[Proto-Scripty] Re: Question regarding Element.observe and Element.stopObserving

2008-10-06 Thread Lea Hayes
This works great, until a form or input element, is within the element hierarchy. It is mainly a problem with the HTML input tag, because most of the time (especially in ASP.NET) everything is contained within the form. html head titleTest Page/title script type=text/javascript

[Proto-Scripty] Re: Question regarding Element.observe and Element.stopObserving

2008-10-05 Thread labs2.0
Still not like what it does to the Event.cache. If you plan an app that should work 8 hours a day, without browser refresh - hey, we are moving on to the browser or what ;) - I think that every bit should be considered, and in an interface with 3 or 4 active windows at time, each one with dozens

[Proto-Scripty] Re: Question regarding Element.observe and Element.stopObserving

2008-10-05 Thread Lea Hayes
Yes, that solves the problem, it now works in IE7/8+FF3. Sadly in Chrome it doesn't appear to work at all. Clicking the stop button does absolutely nothing, yet the method is being called because I tried sticking a test message box in there. The box appears, but the events are simply not

[Proto-Scripty] Re: Question regarding Element.observe and Element.stopObserving

2008-10-04 Thread kangax
On Oct 3, 7:26 pm, Lea Hayes [EMAIL PROTECTED] wrote: This works great, until a form or input element, is within the element hierarchy. It is mainly a problem with the HTML input tag, because most of the time (especially in ASP.NET) everything is contained within the form. html head

[Proto-Scripty] Re: Question regarding Element.observe and Element.stopObserving

2008-10-03 Thread Lea Hayes
Hi, Ah right, that's fair enough. When I wrote that post I didn't realize that you could simply pass a function reference into the each method. Personally I prefer to take advantage of the slightly higher level interfaces provided by Prototype to avoid possible difficulties in future releases.

[Proto-Scripty] Re: Question regarding Element.observe and Element.stopObserving

2008-10-02 Thread labs
Yeah. I know. I did that: Element.addMethods({ clearEvents: function(element) { element.descendants().each( function(obj){ if (obj._prototypeEventID) { obj.stopObserving(); } } );

[Proto-Scripty] Re: Question regarding Element.observe and Element.stopObserving

2008-10-02 Thread puckpuck
When I made that post, I was very groggy, and realized I used a CSS selector *, which well... is horrid slow, especially on IE. using elem.descendants() instead would of made far more sense. Also I would stay away from checking on the existing of _prototypeEventID on the element. This is an

[Proto-Scripty] Re: Question regarding Element.observe and Element.stopObserving

2008-10-02 Thread labs
Yeah, but if you firebug the Event object after recursive unregister, you will see that every element that doesnt had a _prototypeEventID will create an entry in Event.cache. This is because the way the eventId is generated and THERE I'll not mess with :) Those entry are empty, I know, but

[Proto-Scripty] Re: Question regarding Element.observe and Element.stopObserving

2008-10-02 Thread Lea Hayes
Or as puckpuck suggested with the 'descendants' method instead of the CSS selector for greatly improved performance. Object.extend(Element.prototype, { stopObservingNested: function() { this.stopObserving();

[Proto-Scripty] Re: Question regarding Element.observe and Element.stopObserving

2008-10-02 Thread kangax
On Oct 2, 6:15 pm, Lea Hayes [EMAIL PROTECTED] wrote: Or as puckpuck suggested with the 'descendants' method instead of the CSS selector for greatly improved performance. `Element.descendants` uses `Element.select` internally. That's why I used `select` directly (to avoid an extra function