I don\'t find anything about my question here on MDC or the ECMAscript specifications. Probably somebody knows a more \'hacky\' way to solve this.
I\'m calling
(From http://javascriptweblog.wordpress.com/2011/05/03/javascript-strict-mode/)
(...) Strict Mode is not enforced on non-strict functions that are invoked inside the body of a strict function (either because they were passed as arguments or invoked using
call
orapply
).
So if you setup the error methods in a different file, without strict mode, and then pass them as a parameter, like this:
var test = function(fn) {
'use strict';
fn();
}
var deleteNonConfigurable = function () {
var obj = {};
Object.defineProperty(obj, "name", {
configurable: false
});
delete obj.name; //will throw TypeError in Strict Mode
}
test(deleteNonConfigurable); //no error (Strict Mode not enforced)
...it should work.