In strict mode, indirect calls to eval
should have this
bound to the global object in eval code.
10.4.2: In Edition 5, indirect calls to the eval function use the global environment as both the variable environment and lexical environment for the eval code. In Edition 3, the variable and lexical environments of the caller of an indirect eval was used as the environments for the eval code.
However, in Opera, this expression results in undefined
:
(function(){'use strict'; return (0 || eval)('this'); }())
Chrome and Firefox work as expected.
I found this here: http://kangax.github.com/jstests/indirect-eval-testsuite/
Is this a browser bug? If so, is it being tracked yet?
See also Why do some forms of indirect eval fail in Opera and Safari?