mint-metrics / mojito-js-delivery

🧪 Source-controlled JS split testing framework for building and launching A/B tests.
https://mojito.mx/docs/js-delivery-intro
Other
16 stars 30 forks source link

Make the library support JavaScript strict mode #81

Open kingo55 opened 4 years ago

kingo55 commented 4 years ago

If we're to include the Mojito lib inside anywhere that uses the strict interpreter, I think it will fail to run. Adding 'use strict'; to the top of the lib prevents us from even reaching the first test because we omit the "var" declaration for Mojito. Even after adding the var declaration to Mojito, the first test fails, so there's likely a bunch of changes we need to make here.

Judging from MDN's docs, we shouldn't just switch willy-nilly to strict mode because some browsers interpret strict mode differently to one another. Instead, just passing the tests should be enough.

Despite us not needing strict mode so far, if we at least support it, we'll ensure Mojito can run in as many places as possible.

allmywant commented 4 years ago

@kingo55 I agree with you, we should support it.