Some forms of indirect eval
fail in Opera, and, I'm told, in Safari.
[eval][0]('')
Unhandled Error: eval called with invalid this object
Notice that it fails when evaluating an empty string... as far as I can tell it should return undefined
.
Other forms, like (0,eval)('')
, seem to work fine.
Running the examples from this test suite by kangax, I see several forms that fail with the "invalid this object" message in Opera, but not Chrome or Firefox.
Can anyone explain why this happens? What dictates this behavior? It seems intentional, does it adhere to some part of the standard I don't know about?
Related -- SO discussion about indirect vs. direct eval.
Also -- Why is (0 || eval) not treated as indirect in Opera?