Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strict mode not detected if under a comment #54

Closed
johnsonw opened this issue Apr 15, 2015 · 1 comment
Closed

strict mode not detected if under a comment #54

johnsonw opened this issue Apr 15, 2015 · 1 comment

Comments

@johnsonw
Copy link

Strict mode is successfully detected when it is at the very top of the file but if you have a comment before it strict mode will not be detected.
Works:

'use strict';
// This program ...

Does not work:

// This program ...
'use strict';

This can be remedied by adding an 'm' modifier to the end of the regular expression in detectStrictMode.js:

/^\s*(?:"use strict"|'use strict')[ \t]*(?:[\r\n]|;)/gm
@jhnns
Copy link
Owner

jhnns commented Apr 16, 2015

You're right, and your fix is probably sufficient. But afaik that would detect even wrong uses of "use strict" as legitimate.

@jhnns jhnns closed this as completed in bbbd05c Apr 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants