[jQuery] Re: problem filtering out via parents() and :not()

2009-05-01 Thread Ricardo

No #detailsNavigation in your HTML.. and why not simply $
(.metaSection a).click(function(){... ? Also you can swap $thisA.is
(:not... for !$thisA.hasClass('noSwap'), much less overhead.

Despite that code looks fine, could you provide a working sample at
jsbin.com or the likes?

On May 1, 12:29 pm, pixeline aplennev...@gmail.com wrote:
 Hello !
 I'm assigning a specific swap position behaviour on click to a list
 of links, all sitting inside a multilevel unordered list with id
 detailsNavigation

 That behaviour only concerns specific anchors and those with class
 noSwap shouldn't ... swap.

 Can you explain me why this does not work?

  $(#detailsNavigation li ul li a).bind(click, function()
           {
                 var $thisA = $(this);
                 var $thisLI = $thisA.parent();
                 var $thisUL = $thisLI.parent();
                 if ($thisUL.parents('li').is(':not(#metadesign,
 #editions, #timeline, #related)') || $thisA.is(':not(.noSwap)'))
                 {
                 // do that swappin' thingy
                 }

 });

 Here is the related html:

     ul
         li class=clearfix id=metadesign

             ul style=display: block; class=detailsSubnav clearfix
 selected
                 li class=clearfix style=width: 100%;
                     ul class=metaSection clearfix
                         li class=skinColor
 metaSectionTitleconcepts/li
                         lia class=ajax noSwap href=http://m2.lab-
 au.com/projects/f551/metadesign/concepts/8/
                             electrosensing/a/li
                     /ul
                     ul class=metaSection clearfix
                         li style=display: list-item;
                          a class=ajax selected noSwap href=http://
 m2.lab-au.com/projects/f551/metadesign/methods/
 referencing/referencing/a
                         /li
                         li class=skinColor
 metaSectionTitlemethods/li
                         li class=inactivespan
 class=inactiveData mining/span/li
                     /ul
                 /li
             /ul
         /li
     /ul

 Thanks a lot for your help!

 Alexandre


[jQuery] Re: problem filtering out via parents() and :not()

2009-05-01 Thread Alexandre Plennevaux

hi Ricardo!

in fact i removed all code that was out of the realm of this issue, to
not make you guys read 50 lines of codes.

i keep the hasClass() suggestion though !

i don't understand why parents().is(':not() does not work though. I
wonder if there isn't a bug because it used to work before, with
jquery 1.2.6. Maybe the switch to sizzle provoked it. I'll have to
investigate to confirm that.

thanks!

On Fri, May 1, 2009 at 7:35 PM, Ricardo ricardob...@gmail.com wrote:

 No #detailsNavigation in your HTML.. and why not simply $
 (.metaSection a).click(function(){... ? Also you can swap $thisA.is
 (:not... for !$thisA.hasClass('noSwap'), much less overhead.

 Despite that code looks fine, could you provide a working sample at
 jsbin.com or the likes?

 On May 1, 12:29 pm, pixeline aplennev...@gmail.com wrote:
 Hello !
 I'm assigning a specific swap position behaviour on click to a list
 of links, all sitting inside a multilevel unordered list with id
 detailsNavigation

 That behaviour only concerns specific anchors and those with class
 noSwap shouldn't ... swap.

 Can you explain me why this does not work?

  $(#detailsNavigation li ul li a).bind(click, function()
           {
                 var $thisA = $(this);
                 var $thisLI = $thisA.parent();
                 var $thisUL = $thisLI.parent();
                 if ($thisUL.parents('li').is(':not(#metadesign,
 #editions, #timeline, #related)') || $thisA.is(':not(.noSwap)'))
                 {
                 // do that swappin' thingy
                 }

 });

 Here is the related html:

     ul
         li class=clearfix id=metadesign

             ul style=display: block; class=detailsSubnav clearfix
 selected
                 li class=clearfix style=width: 100%;
                     ul class=metaSection clearfix
                         li class=skinColor
 metaSectionTitleconcepts/li
                         lia class=ajax noSwap href=http://m2.lab-
 au.com/projects/f551/metadesign/concepts/8/
                             electrosensing/a/li
                     /ul
                     ul class=metaSection clearfix
                         li style=display: list-item;
                          a class=ajax selected noSwap href=http://
 m2.lab-au.com/projects/f551/metadesign/methods/
 referencing/referencing/a
                         /li
                         li class=skinColor
 metaSectionTitlemethods/li
                         li class=inactivespan
 class=inactiveData mining/span/li
                     /ul
                 /li
             /ul
         /li
     /ul

 Thanks a lot for your help!

 Alexandre