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 use strict
on every javascript file in my environment. All my files start like this
(function(win, doc, undef) {
use strict;
// code & functions
}(window, window.document));
Now, I have a custom function which handles errors. That functions uses the .caller
property to provide a context stack trace. Looks like this:
var chain = (function() {
var _parent = _error,
_ret = '';
while( _parent.caller ) {
_ret += ' -> ' + _parent.caller.name;
_parent = _parent.caller;
}
return _ret;
}());
But of course, in strict mode .caller
is a non-deletable prop which throws when retrieved. So my question is, is anybody aware of way to disable strict more function-wise ?
use strict;
is inherited by all functions after it was called. Now we have the possibilty to just use strict mode in specific functions by just calling use strict;
at the top of those, but is there a way to achieve the opposite ?