On May 26, 2:14 am, "Michael Geary" <[EMAIL PROTECTED]> wrote:
> > > $.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.
> > This also doesn't work. I have tried both $.extend({}, $)
> > and $.extend(true, {}, $). This results in $D('body') is not
> > a function error. Seems that it doesn't copy really.
>
> That's what I get for posting late at night. Of course that wouldn't work,
> because you need to clone the jQuery constructor function itself - which {}
> doesn't do.
>
> This would have a better chance of working:
>
> $D = eval( '' + jQuery );
> $D.prototype = jQuery.extend( {}, jQuery.prototype );
>
> A quick test seems to work - but I'm not sure about cross-browser support,
> and there could be issues because of assumptions made inside the jQuery
> code.
<snip>
I'm sorry for the very late follow up. I was quite busy to try
this. And, it works for $D('body'), but I get error when trying to
extend:
$D.fn.extend({
click: function() {
alert('overridden click');
return this;
}
});
Throws "$D.fn has no properties" error like before.
--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/