Re: [jQuery] jQuery copy constructor

2006-08-29 Thread Ferdinand Beyer
Great news! Thanks! John Resig schrieb: > Ferdinand - > > I just added in object cloning with the constructor function, you can now do: > > var div = $("div") > $(div).find("span") > > and have the original 'div' still contain what it's supposed to. > > --John ___

Re: [jQuery] jQuery copy constructor

2006-08-29 Thread John Resig
Ferdinand - I just added in object cloning with the constructor function, you can now do: var div = $("div") $(div).find("span") and have the original 'div' still contain what it's supposed to. --John On 8/28/06, Ferdinand Beyer <[EMAIL PROTECTED]> wrote: > Hi! > > In a recent project I often

Re: [jQuery] jQuery copy constructor

2006-08-29 Thread Dave Cardwell
Ferdinand Beyer wrote: > 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 > > What do you think about that? C

Re: [jQuery] jQuery copy constructor

2006-08-29 Thread Michael Geary
> From: Ferdinand Beyer > > 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 It looks like jQuery 1.0 doe

Re: [jQuery] jQuery copy constructor

2006-08-29 Thread Christof Donat
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

[jQuery] jQuery copy constructor

2006-08-28 Thread Ferdinand Beyer
Hi! In a recent project I often needed to copy a jQuery object to perform a subquery without losing the original object. As far as I can see there is no "official way" to do this so I came up with a small extension function: $.fn.newQuery = function() { var c = $(); c.cur = $.merge([]

Re: [jQuery] jQuery copy constructor

2006-08-26 Thread Jörn Zaefferer
Ferdinand Beyer wrote: > Hi! > > In a recent project I often needed to copy a jQuery object to save a > subquery without losing the original query. As far as I can see there is > no "official way" to do this so I came up with a small extension function: > Hi Ferdinand, though it looks like th

Re: [jQuery] jQuery copy constructor

2006-08-26 Thread John Resig
Hi Ferdinand, > 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 > > What do you think about that? I snuck that

[jQuery] jQuery copy constructor

2006-08-26 Thread Ferdinand Beyer
Hi! In a recent project I often needed to copy a jQuery object to save a subquery without losing the original query. As far as I can see there is no "official way" to do this so I came up with a small extension function: $.fn.newQuery = function() { var c = $(); c.cur = $.merge([], th