On Fri, Mar 18, 2011 at 10:45 AM, Oliver Hunt <oli...@apple.com> wrote: > I think so -- my proposal doesn't take instances, nor produce instances, it > takes the constructor function (Image is one of a handful of DOM constructor > that can actually be used to construct things) and returns a new constructor > that will produce an instances of the target object with a modified prototype > chain.
Andreas in IM that we hang it on the prototype chain, so that we get it everywhere without repetitive specification. How about: Function.prototype.createDelegatingTo = function (obj) { var o = new this; // really new-with-apply(arguments) here o.__proto__ = obj; return o; } Then Array.createDelegatingTo, Boolean.createDelegatingTo, Image, etc. should all work. (I like the longer, grosser name because I think it's sort of a gross pattern, and not something that should use up a concise name.) Mike _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss