Well, considering that you're using two DOM elements, which does not
determine if one is in another, I'd imagine that a bugqould come up
;-)

We were talking about possibly implementing that at some point, but
haven't gotten around to it, yet.

--John

On 1/22/09, Richard D. Worth <[email protected]> wrote:
> See
>
> http://groups.google.com/group/jquery-en/browse_thread/thread/9efd1af2e2076eb9
>
> Is this a bug?
>
> test("Given two jQuery objects a and b, find whether b is within a. Test 1:
> b not within a", function() {
>     //b is not within a
>     //expect 0
>     var a = jQuery('<div id="a"></div>');
>     var b = jQuery('<div id="b"></div>');
>     equals( jQuery(b[0], a[0]).length, 0 );
>     equals( a.find(b[0]).length, 0 );
>     equals( jQuery(b).parents().filter(function() { return this === a[0];
> }).length , 0 );
> });
>
> test("Given two jQuery objects a and b, find whether b is within a. Test 2:
> b within a", function() {
>     //b is within a
>     //expect 1
>     var a = jQuery('<div id="a"><div id="b"></div></div>');
>     var b = a.find("#b");
>     equals( jQuery(b[0], a[0]).length, 1 );
>     equals( a.find(b[0]).length, 1 );
>     equals( jQuery(b).parents().filter(function() { return this === a[0];
> }).length , 1 );
> });
>
> I'm getting a false positive on
>
> jQuery(b[0], a[0]).length
>
> and a false negative on
>
> a.find(b[0]).length
>
> Thanks.
>
> - Richard
>
> >
>


-- 
--John

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

Reply via email to