Loading JavaScript modules via IFRAME
Another in the list of "I don't have a need for it now, but..." - this is also old hat on the Web but was new to me. I've been intrigued by the Modules proposal for ECMAScript "Harmony" . Since I like polyfills (so soothing...) I've been wondering what the subset is that could be implemented as a polyfill is, so that you can write code that runs in both ES5 and ES6 environments (i.e. the Web). I noodled around a bit with this many months ago and the key piece that was missing is sandboxed evaluation of the code, with unique "intrinsics" i.e. Object, Array, their prototypes, etc. The scenario is that you're running code like: Object.prototype.awesome = function() { return "foo"; }; But you load a third party module that one day decides to add: Object.prototype.awesome = function() { return "bar"; }; If partying on the Object prototype isn't part of the contract with the module (and it shouldn't be!...