That would be pretty sweet.  But in the mean time, Jorn, maybe you
could use something like:

jQuery.fn.ifFound = function(condition) {
  return (this.length === condition)?this:jQuery([]);
}

So you could do $('#field1, #field2').ifFound(3).length

-- dz



On Sun, Feb 8, 2009 at 5:39 AM, Daniel Friesen
<nadir.seen.f...@gmail.com> wrote:
>
> Jörn Zaefferer's idea is basically '#field1 & #field2' is similar to the
> comma but not the same.
>
> '#field1, #field2' If neither #field1 nor #field2 exist use 0, if one of
> them exists use that one, if both exist use both.
> The difference is:
> '#field1 & #field2' If neither #field1 nor #field2 exist then use
> nothing, if both exist use both, however if #field1 exists but not
> #field2 or vise versa do not use either one.
>
> ~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://nadir-seen-fire.com]
> -Nadir-Point (http://nadir-point.com)
> -Wiki-Tools (http://wiki-tools.com)
> -MonkeyScript (http://monkeyscript.nadir-point.com)
> -Animepedia (http://anime.wikia.com)
> -Narutopedia (http://naruto.wikia.com)
> -Soul Eater Wiki (http://souleater.wikia.com)
>
>
>
> Morgan Allen wrote:
>> is this different from $('#field1, #field2')?
>>
>> On Sun, Feb 8, 2009 at 2:03 AM, Jörn Zaefferer <
>> joern.zaeffe...@googlemail.com> wrote:
>>
>>
>>> Is it possible to implement a and-selector with Sizzle? Say, something
>>> like this:
>>>
>>> $("#field1 & #field2").length would be either 0 or 2, but never 1.
>>>
>>> This would be extremely useful for the validation plugin to specify
>>> dependencies, where currently rather clunky callbacks have to be used.
>>>
>>> Jörn
>>>
>>>
>>
>>
>>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to