[jQuery] Re: exclude children from selected elements

2008-11-22 Thread ricardobeat
Thanks! Unfortunately I still work in a jQuery-less environment, but that's changing :) cheers, - ricardo On Nov 22, 2:14 am, Karl Swedberg <[EMAIL PROTECTED]> wrote: > One very minor note: you don't need to do this: > >         var elm = e.target || e.srcElement; > > this is fine: > >         v

[jQuery] Re: exclude children from selected elements

2008-11-21 Thread Karl Swedberg
One very minor note: you don't need to do this: var elm = e.target || e.srcElement; this is fine: var elm = e.target; jQuery normalizes the target property. From the core file ... // Fix target property, if necessary if ( !event.target ) even

[jQuery] Re: exclude children from selected elements

2008-11-21 Thread ricardobeat
By the way, you could use event delegation to simplify things a lot: $(document).ready(function(){ $('body').mouseover(function(e){ var elm = e.target || e.srcElement; if ( !$(elm).parents('.ui-dialog').length ) { //if .ui-dialog is not an ancestor $(elm).doStuff();

[jQuery] Re: exclude children from selected elements

2008-11-21 Thread Bob O
Why dont you fire an event after the children have been loaded that removes them? On Nov 21, 3:07 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > My mistake, it is working. The problem was my lack of understanding > about how Dialog works.  main is the div from which I create a Dialog > an

[jQuery] Re: exclude children from selected elements

2008-11-21 Thread [EMAIL PROTECTED]
My mistake, it is working. The problem was my lack of understanding about how Dialog works. main is the div from which I create a Dialog and I didn't want the event listener to be added to the elements of main. However main is NOT the first element of the Dialog. I the background it is wrapped ar

[jQuery] Re: exclude children from selected elements

2008-11-21 Thread [EMAIL PROTECTED]
It still doesn't work. I think part of the problem is because the children of main are added after I create the event listener. Second solution is to check in the event listener if the target is a child of main and if so, return. I know how to get the children of main , but how to I check the cu

[jQuery] Re: exclude children from selected elements

2008-11-20 Thread ricardobeat
Are you sure you want to apply it to *all* elements on the page? That sounds a bit awkward. var main = $('#main, #main *'); $('body *').not(main).mouseover(function(){...}); On Nov 20, 2:07 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi, > > I want to apply a mouseover event on all ele

[jQuery] Re: exclude children from selected elements

2008-11-20 Thread [EMAIL PROTECTED]
That doesn't work, it doesn't exclude #main and its children On 20 nov, 17:07, "Hector Virgen" <[EMAIL PROTECTED]> wrote: > This might work better with filter() (untested): > > $('*').filter('#main, #main *').mouseover(function() { > > }); > > -Hector > > On Thu, Nov 20, 2008 at 8:07 AM, [EMAIL P

[jQuery] Re: exclude children from selected elements

2008-11-20 Thread Hector Virgen
This might work better with filter() (untested): $('*').filter('#main, #main *').mouseover(function() { }); -Hector On Thu, Nov 20, 2008 at 8:07 AM, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote: > > Hi, > > I want to apply a mouseover event on all elements but one and its > children. I can't