[jQuery] Re: jQuery.extend not working for function as target,is it a bug?
Hello Jacky, > what reversion number of jquery you use? I was using the original 1.2.1 stable release: Rev: 3353 > This was a change from changeset [3841]. There were some issues > with deep copy and this was one of the changes to prevent the > problems. The problem you are having should be fixed in [3985]. Looks like David's right, we're working from different versions. Thanks David! Charles
[jQuery] Re: jQuery.extend not working for function as target,is it a bug?
is there any reason to use first variant instead of second? jQuery.extend(target, {}) jQuery.extend(target.prototype, {}) 2007/11/30, David Serduke <[EMAIL PROTECTED]>: > > Ah the beauty of bug fixes. Fix one thing and break another. This > was a change from changeset [3841]. There were some issues with deep > copy and this was one of the changes to prevent the problems. The > problem you are having should be fixed in [3985]. > > Sorry bout that. > > David > -- Максим Игоревич Гришаев, AstroStar.ru
[jQuery] Re: jQuery.extend not working for function as target,is it a bug?
Ah the beauty of bug fixes. Fix one thing and break another. This was a change from changeset [3841]. There were some issues with deep copy and this was one of the changes to prevent the problems. The problem you are having should be fixed in [3985]. Sorry bout that. David
[jQuery] Re: jQuery.extend not working for function as target,is it a bug?
Hi polyrhythmic, what reversion number of jquery you use? i use the newest jquery from svn.reversion number of the jquery is #3973,is that of you used? * $Date: 2007-11-29 07:53:54 +0800 (星期四, 29 十一月 2007) $ * $Rev: 3973 $ Regards Jacky 2007/11/30, polyrhythmic <[EMAIL PROTECTED]>: > > > Hello Jacky, > > I can't reproduce your error. jQuery.extend should work for > functions, this is how it works internally. Perhaps there is an issue > in your code I cannot see. I ran the following through the Firebug > console just now with these results: > [ : my commands ] > > >>> var targetfn = function() { console.log('I am tgtfn'); }; > >>> targetfn(); > I am tgtfn > >>> $.extend(targetfn, { childfn: function() { console.log('I am > childfn'); } }); > function() > >>> targetfn.childfn(); > I am childfn > >>> alert(typeof targetfn.childfn); > [alerted "function"] > > What browser are you testing in? I know that there are issues with > typeof not returning the proper value for functions, that's part of a > long discussion on the jQuery-dev list: > > http://groups.google.com/group/jquery-dev/browse_thread/thread/89cc50c9e936feb6?hl=en > Things are running right for me in Firefox 2.0.0.10 on XP. > > Charles > > On Nov 29, 4:15 am, Jacky <[EMAIL PROTECTED]> wrote: > > /* > > * jQuery 1.2.1 - New Wave Javascript > > * > > * Copyright (c) 2007 John Resig (jquery.com) > > * Dual licensed under the MIT (MIT-LICENSE.txt) > > * and GPL (GPL-LICENSE.txt) licenses. > > * > > * $Date: 2007-11-29 07:53:54 +0800 (星期四, 29 十一月 2007) $ > > * $Rev: 3973 $ > > */ > > > > the jQuery reversion is #3973,function can't extend with > > jQuery.extend. > > > > function target(){ > > /**some code here*/ > > > > } > > > > jQuery.extend(target,{ > > someMethod:function(){ > > /** some code here */ > > } > > > > }); > > > > alert(typeof target.someMethod);// type of target.someMethod is > > undefined >
[jQuery] Re: jQuery.extend not working for function as target,is it a bug?
I think it may be down to the distinction between function target(){ /*this one won't extend!*/ } and var target = function(){ /*this one will extend!*/ }; ? On Nov 29, 6:23 pm, polyrhythmic <[EMAIL PROTECTED]> wrote: > Hello Jacky, > > I can't reproduce your error. jQuery.extend should work for > functions, this is how it works internally. Perhaps there is an issue > in your code I cannot see. I ran the following through the Firebug > console just now with these results: > [ : my commands ] > > >>> var targetfn = function() { console.log('I am tgtfn'); }; > >>> targetfn(); > I am tgtfn > >>> $.extend(targetfn, { childfn: function() { console.log('I am childfn'); } > >>> }); > function() > >>> targetfn.childfn(); > I am childfn > >>> alert(typeof targetfn.childfn); > > [alerted "function"] > > What browser are you testing in? I know that there are issues with > typeof not returning the proper value for functions, that's part of a > long discussion on the jQuery-dev > list:http://groups.google.com/group/jquery-dev/browse_thread/thread/89cc50... > Things are running right for me in Firefox 2.0.0.10 on XP. > > Charles > > On Nov 29, 4:15 am, Jacky <[EMAIL PROTECTED]> wrote: > > > /* > > * jQuery 1.2.1 - New Wave Javascript > > * > > * Copyright (c) 2007 John Resig (jquery.com) > > * Dual licensed under the MIT (MIT-LICENSE.txt) > > * and GPL (GPL-LICENSE.txt) licenses. > > * > > * $Date: 2007-11-29 07:53:54 +0800 (星期四, 29 十一月 2007) $ > > * $Rev: 3973 $ > > */ > > > the jQuery reversion is #3973,function can't extend with > > jQuery.extend. > > > function target(){ > > /**some code here*/ > > > } > > > jQuery.extend(target,{ > > someMethod:function(){ > > /** some code here */ > > } > > > }); > > > alert(typeof target.someMethod);// type of target.someMethod is > > undefined
[jQuery] Re: jQuery.extend not working for function as target,is it a bug?
Hello Jacky, I can't reproduce your error. jQuery.extend should work for functions, this is how it works internally. Perhaps there is an issue in your code I cannot see. I ran the following through the Firebug console just now with these results: [ : my commands ] >>> var targetfn = function() { console.log('I am tgtfn'); }; >>> targetfn(); I am tgtfn >>> $.extend(targetfn, { childfn: function() { console.log('I am childfn'); } >>> }); function() >>> targetfn.childfn(); I am childfn >>> alert(typeof targetfn.childfn); [alerted "function"] What browser are you testing in? I know that there are issues with typeof not returning the proper value for functions, that's part of a long discussion on the jQuery-dev list: http://groups.google.com/group/jquery-dev/browse_thread/thread/89cc50c9e936feb6?hl=en Things are running right for me in Firefox 2.0.0.10 on XP. Charles On Nov 29, 4:15 am, Jacky <[EMAIL PROTECTED]> wrote: > /* > * jQuery 1.2.1 - New Wave Javascript > * > * Copyright (c) 2007 John Resig (jquery.com) > * Dual licensed under the MIT (MIT-LICENSE.txt) > * and GPL (GPL-LICENSE.txt) licenses. > * > * $Date: 2007-11-29 07:53:54 +0800 (星期四, 29 十一月 2007) $ > * $Rev: 3973 $ > */ > > the jQuery reversion is #3973,function can't extend with > jQuery.extend. > > function target(){ > /**some code here*/ > > } > > jQuery.extend(target,{ > someMethod:function(){ > /** some code here */ > } > > }); > > alert(typeof target.someMethod);// type of target.someMethod is > undefined