This came out of disabling "use strict"; everywhere thread
https://mail.mozilla.org/pipermail/es-discuss/2013-January/028511.html
After a better analysis, I have realized it is possible to simulate the
monocle mustache in ES5 via "use strict";
Any thought on this, appreciated.
function With(o) {
return function (f) {
return Function(
"with(this){return(" + ("" + f).replace(
"{", "{'use strict';"
) + ").call(this)}"
).call(o);
};
}
With({test: 123})(function () {
alert(test); // 123
outer = 456; // throws outer is not defined
});
alert(With({test: 123})(function () {
return test;
}));
br
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss