Woops!
    isVisible: function(element) {
        var ok = $(element).visible();
        if (!ok) {
            return false;
        }

        $(element).ancestors().each(
            function(obj){
                ok = obj.visible();
                if (!ok) throw $break;
            }
        );
        return ok;
    }

hehehe... my fault...
[]'s
Labs

On Oct 5, 10:44 am, "labs2.0" <[EMAIL PROTECTED]> wrote:
> 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 of comps listening god knows what, and a create/
> destroy cycle of about two or tree windows per minute... I dont
> know...
>
> One other thing that maybe fits beter in fresh new topic:
> element.visible()
> Its just not ok. When I want to know if that element is visible, I
> mean by the users point of view, so, if its display is not none but
> its div container is, well, thats pretty unvisible to me.
>
> So...
>
>     isVisible: function(element) {
>         var ok = $(element).visible();
>         if (!ok) return false;
>         $(element).ancestors().each(
>             function(obj){
>                 if (!obj.visible()) throw $break;
>             }
>         );
>         return ok;
>     }
>
> ...or please a better optimized way to do that ;)
>
> []'s
> Labs
>
> On Oct 4, 6:09 pm, kangax <[EMAIL PROTECTED]> wrote:
>
> > 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>
> > >         <title>Test Page</title>
> > >         <script type="text/javascript" src="prototype.js"></script>
> > >         <script type="text/javascript">
> > >                 Object.extend(Element.Methods, {
> > >                         stopObservingNested: function(element) {
> > >                                 element.stopObserving();
> > >                                 
> > > element.descendants().each(Element.stopObserving);
> > >                         }
> > >                 });
> > >                 Element.addMethods();
>
> > >                 window.onload = function() {
> > >                         $('testDiv').observe('click', function(event) { 
> > > alert('clicked div'); });
> > >                         $('testSpan').observe('click', function(event) { 
> > > alert('clicked span'); });
> > >                         $('testClear').observe('click', function(event) {
> > >                                 var el = $('testDiv');
> > >                                 el.stopObservingNested();
> > >                         });
> > >                 }
> > >         </script>
> > > </head>
> > > <body>
> > >         <div id="testDiv">
> > >                 <!-- Form causes "eventName.include is not a function" 
> > > prototype.js Line: 3942
> > >                 <form>
> > >                         <span id="testSpan">
> > >                                 Hello World!
> > >                         </span>
> > >                 </form>
> > >                 &nbsp;-&nbsp;Div Part!
> > >         </div>
>
> > >         <input id="testClear" type="button" value="Clear Events" />
> > > </body>
> > > </html>
>
> > I'm an idiot : )
> > This error has nothing to do with the form, but is due to the way
> > `stopObserving` works. We had this "issue" fixed in a trunk but then
> > it was temporarily removed before 1.6.0.3 release. The problem is that
> > `stopObserving` accepts optional 2nd and 3rd arguments and when passed
> > as an iterator (to `each`) it gets called with `value` and `index`
> > arguments that are being passed to an iterator.
>
> > You can use `invoke` meanwhile (don't forget to extend an element
> > first and then return it from the method):
>
> > Element.addMethods({
> >   stopObservingNested: function(element) {
> >     element = $(element);
> >     element.descendants().invoke('stopObserving');
> >     return element.stopObserving();
> >   }
>
> > });
>
> > --
> > kangax
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to