The issue is that what you're trying to do is currently
(unfortunately) not supported by the jQuery selector engine. The
selector isn't "that bad":
$("li:not([ol:not([EMAIL PROTECTED])])")

The problem is that you have both nested () and nested [] - both of
which fail in jQuery (it's quite fickle right now).

So, the only solution that'll solve your problem would by one that's
much more verbose:

$("li").filter(function(){
  return $("ol:not([EMAIL PROTECTED])", this).length == 0;
});

(Both of these are untested, but they should do the trick or, at
least, put you on the right path)

Hope this helps!

--John

On 1/1/07, Oliver Boermans <[EMAIL PROTECTED]> wrote:
> On 31/12/06, Blair Mitchelmore <[EMAIL PROTECTED]> wrote:
> > I'm not sure but I think that .not(obj) is currently implemented to
> > exclude singular DOM elements, meaning arrays of elements and jQuery
> > element sets wouldn't do anything. That could maybe be an API change for
> > jQuery 1.1?
> >
> > -blair
>
> Sounds like a good idea - I guess the next step is to submit a bug?
>
> In the meantime - perhaps there is a different way to solve the
> problem I am tackling. If it's messy enough perhaps the need for added
> .not() functionality will be clarified.
>
> I am aiming to select every li whose immediate children ol elements
> ALL have a particular attribute set (previously with javascript).
>
> Example HTML:
> ...
> <ol>
>         <li> <!-- This li should NOT be selected -->
>                 <ol> <!-- As this li lacks attribute 'kids' -->
>                         <li>...</li>
>                 </ol>
>                 <ol kids="4">
>                         <li>...</li>
>                         <li>...</li>
>                         <li>...</li>
>                         <li>...</li>
>                 </ol>
>                 <ol kids="2">
>                         <li>...</li>
>                         <li>...</li>
>                 </ol>
>         </li>
>         <li> <!-- This li should be selected -->
>                 <ol kids="3"> <!-- As this li AND... -->
>                         <li>...</li>
>                         <li>...</li>
>                         <li>...</li>
>                 </ol>
>                 <ol kids="1"> <!-- this li both have attribute 'kids' -->
>                         <li>...</li>
>                 </ol>
>         </li>
> </ol>
> ...
>
> Another way of expressing what I'm trying to do:
>
> $("li").not("[EMAIL PROTECTED]'undefined']]")...
>
> Obviously this doesn't work on a number of levels.
>
> It occured to me that I could, earlier in the process, set kids to 0
> on every ol. Allowing for something more like
>
> $("li").not("[EMAIL PROTECTED]'0']]")...
>
> But this didn't solve my fundamental problem - how do I check
> attributes of ALL the children of the li?
>
> Am I asking the right question?
> My mind is a soup of confused double negatives ;/
>
> Happy New Year!
> Ollie
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to