oj icon indicating copy to clipboard operation
oj copied to clipboard

Support `use strict`: Change with(oj) to oj.extendInto(this)

Open IngwiePhoenix opened this issue 9 years ago • 1 comments

https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/with

Many scripts and libraries use "use strict";. In order to not run into complications, OJ probably should extend into the scope that it wants to. In the case of a rendering sequence:

(function(){try{ oj.extendInto(this); (function(){
    h1("Foo bar");
}).apply(this);}catch(e){ handle_error(e); }})();

Just a thought, since I just read the article.

IngwiePhoenix avatar May 03 '15 01:05 IngwiePhoenix

This is a great idea, thank you! In addition to this, there are a couple secret things that OJ does that may not be compatible with use strict, for example the way OJ creates dynamic prototypes is pretty fancy :). That said, I think it's a worthy goal that OJ v2.0 supports use strict. Let's do this!

evanmoran avatar Dec 30 '17 22:12 evanmoran