How would options = $.beget($.myplugin.defaults, options || {}); be different than options = $.extend({}, $.myplugin.defaults, options || {}); ?
On Jul 30, 11:48 am, Már Örlygsson <mar.orlygs...@gmail.com> wrote: > Hi. > If it hasn't been already considered (and rejected), I'd like to float > the idea of adding support for prototypal inheritance into the jQuery > core library. > > Something like this... > > jQuery.beget = function (proto, props) { > var F = function () {}; > F.prototype = proto; > var instance = new F(); > return props ? $.extend(instance, props) : instance; > }; > > ...becomes immensely powerful - especially during plugin development > when allowing users to extend/override default options > > options = $.beget($.myplugin.defaults, options || {}); > > ...and in various other common use cases - including $.fn.data() > assignments, etc. > > I for one would love to see this feature added. > > -- > Már --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---