$.extend(foo) merely returns a reference to foo. It doesn't clone foo.
$.extend( {}, foo ) creates a new object and copies all of foo's properties
into it (doing a shallow copy).
So in theory you may be able to use $.extend( {}, $ ) - or more properly,
jQuery( {}, jQuery ) - to clone the jQuery constructor. I wouldn't promise
that this would work, though - it depends on what assumptions the jQuery
code makes.
-Mike
> I want to clone the jQuery object $ to $D; but it actually seems to be
> overwriting. Can anyone please suggest any solution?
>
> Here is the code:
>
> $D = $.extend($); // same result for $D = $;
> $D.fn.extend({
> click: function() {
> alert('overridden click');
> return this;
> }
> });
>
> $(document).ready(function(){
> $('body').click(); // this also triggers the
> 'overridden click' --
> which is what I want to avoid.
> $D('body').click();
> });
>
> As you see, $('body').click() triggers the 'overridden click', but I
> wanted it to trigger the original jQuery object's click.