Hi,

> $.fn.newQuery = function()
> {
>      var c = $();
>      c.cur = $.merge([], this.cur);
>      return c;
> }

I don't like the name. Maybe "copy" states better what the function does.

Have you tried this kind of implementaiton:

$.fn.copy = function() {return $(this.get());};

I don't know if that is faster or not, but I am shure, it is shorter :-)

> What I would really like to see in the standard library is that jQuery
> objects can be passed to the $() function to obtain a copy:
>
> var $a = $('some.query');
> var $b = $($a);
>
> $b.filter('some.criteria'); // Does not affect $a

How about using $('some.criteria',$a) this actually uses the following code:

----
// Watch for when a jQuery object is passed at the context
if ( c && c.jquery )
        return $(c.get()).find(a);
----

which is pretty much the same technique that I have used above.

Christof

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to