- From: Charles Pritchard <chuck@jumis.com>
- Date: Mon, 11 May 2009 18:05:35 -0700
Are expando / prototype functions at all included in the HTML 5 specs? While we may all know what Object.prototype does, I'd like to see its use added to Section 6: Web browsers. The Prototype Expando is not necessarily a Javascript-only construct, and neither is HTML 5. While I'm not championing full prototype inheritance, I do wonder (out-loud), whether some small section of HTML 5 might be describe the most basic of prototyping and expandos: Many projects use "ellipse" or other shapes for example, but this is easier: CanvasRenderingContext2D.prototype.funcName = function() { alert("Fill"+this.fillStyle); } .... document.createElement('canvas').getContext('2d').funcName(); I've never seen any developers attempt to use multiple inheritance within the CanvasRenderingContext2D object, nor have I tested myself to see if Firefox (the champion of such schemes) supports it. Which is why I'd be more than satisfied simply requiring single inheritance. It's already available in all implementations, and we spent a good deal of time making it available in our own. Expando Prototype would need descriptions of: expandos, prototyped objects, for(... in ...) All modern browsers support prototype, and so do many languages (without writing libraries). We've confirmed that it expandos and prototypes work just fine in Active X, MS long ago created IDispatchEx. Any host language with getter / setter availability can implement prototyping and expandos on an object, at least of one depth. I'd like to see ".prototype" described in the scripting section. That said, I'm more hesitant to champion ".constructor" and ".__proto__". -Charles
Received on Monday, 11 May 2009 18:05:35 UTC