Oops, my mistake, Dave... thanks for the light! :-)

About these methods you quoted: they really seem interesting for this use, I
agree. I'll study them and make a benchmark, because it may indeed be faster
to use a pre-compiled comparison method using directly two elements than
doing a down-up traversing until I find the 'html' element...

By the way, I started a little project for doing jQuery benchmarks for its
parts (not to do library comparison, like jQuery VS Prototype VS etc, but
comparison between different ways to accomplish the same task using jQuery).
The code is still a big mess, because it started as a benchmark for
JavaScript 1.6 Array methods implementation VS jQuery ones VS hard-coded
implementation using Mozilla's algorithmns, but I promise I'll organize all
the code! Here it is:
http://sourceforge.net/projects/jqbench/

Thank you, guys!

Diogo



On Sun, Nov 30, 2008 at 1:39 AM, Dave Methvin <[EMAIL PROTECTED]>wrote:

>
> > var uniqueDiv = $('div#unique');
> > uniqueDiv.length == 1;
> > uniqueDiv.remove();
> > uniqueDiv.length == 1; // OK... not an expected behaviour, is it?! ;-)
>
> Diogo, that is actually expected because you may often want to remove
> the element from the DOM and insert it later. You wouldn't want the
> element to disappear from your jQuery object just because it was
> removed from the DOM. I can definitely see the usefulness of being
> able to detect whether the element is still in the DOM though.
>
> For the implementation it would probably be fastest to use the
> contains or compareDocumentPosition methods; John did a writeup
> earlier in the year.
>
> http://ejohn.org/blog/comparing-document-position/
>
> >
>


-- 
Diogo Baeder
http://www.diogobaeder.com.br

--~--~---------~--~----~------------~-------~--~----~
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