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

JavaScript strict warning while (match = regex.exec(string)) {...} #1173

Closed
mmokrejs opened this issue Apr 27, 2015 · 6 comments
Closed

JavaScript strict warning while (match = regex.exec(string)) {...} #1173

mmokrejs opened this issue Apr 27, 2015 · 6 comments
Labels
Accepted Issue has been reproduced by MathJax team Fixed Test Not Needed v2.6
Milestone

Comments

@mmokrejs
Copy link

Hi,
I compiled seamonkey/firefox with DEBUG output enabled and it prints out on STD{OUT,ERR} a lot of messages. There are some related to your code ( I was browsing http://mbe.oxfordjournals.org ):

JavaScript strict warning: http://mbe.oxfordjournals.org/shared/js/jquery-min.js, line 16: SyntaxError: test for equality (==) mistyped as assignment (=)?
JavaScript strict warning: http://mbe.oxfordjournals.org/shared/js/jquery-min.js, line 17: SyntaxError: test for equality (==) mistyped as assignment (=)?
JavaScript strict warning: http://mbe.oxfordjournals.org/shared/js/jquery-min.js, line 18: SyntaxError: test for equality (==) mistyped as assignment (=)?
JavaScript strict warning: http://mbe.oxfordjournals.org/shared/js/jquery-min.js, line 16: ReferenceError: reference to undefined property f.valHooks[this]
JavaScript strict warning: http://mbe.oxfordjournals.org/shared/js/hw-shared.js, line 76: TypeError: variable i redeclares argument
JavaScript strict warning: http://mbe.oxfordjournals.org/shared/js/hw-shared.js, line 193: TypeError: variable i redeclares argument
JavaScript strict warning: http://mbe.oxfordjournals.org/shared/js/hw-shared.js, line 466: SyntaxError: test for equality (==) mistyped as assignment (=)?
JavaScript strict warning: http://mbe.oxfordjournals.org/shared/js/hw-shared.js, line 475: SyntaxError: test for equality (==) mistyped as assignment (=)?
^G[2313] ###!!! ASSERTION: Should have a valid plugin instance or not receive events.: 'mInstance', file /var/tmp/portage/www-client/seamonkey-2.33.1/work/comm-release/mozilla/dom/plugins/base/nsPluginInstanceOwner.cpp, line 1394
^G[2313] ###!!! ASSERTION: Should have a valid plugin instance or not receive events.: 'mInstance', file /var/tmp/portage/www-client/seamonkey-2.33.1/work/comm-release/mozilla/dom/plugins/base/nsPluginInstanceOwner.cpp, line 1394
[2313] WARNING: NS_ENSURE_TRUE(ParseTypeAttribute(type, &version)) failed: file /var/tmp/portage/www-client/seamonkey-2.33.1/work/comm-release/mozilla/dom/base/nsScriptLoader.cpp, line 571
JavaScript strict warning: http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML, line 19: SyntaxError: test for equality (==) mistyped as assignment (=)?
JavaScript strict warning: http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML, line 19: ReferenceError: reference to undefined property args.execute
JavaScript strict warning: http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML, line 19: ReferenceError: reference to undefined property this.head
JavaScript strict warning: http://mbe.oxfordjournals.org/resource/js/main.js, line 119: SyntaxError: test for equality (==) mistyped as assignment (=)?

@dpvc
Copy link
Member

dpvc commented Apr 27, 2015

Most sites, including the one you are looking at, use the compressed version of MathJax, and so all of its code is on one line (line 19 in this case). So it is hard to tell what exactly is triggering the warning.

I suspect that it is this line:

while (match = regex.exec(string)) {

which does an assignment within the condition of the while statement. This is perfectly legal (though it may look like an typo), and is correct in this case.

Thanks for reporting the warning, but it turns out to be correct as is, so I'm closing the issue.

@dpvc dpvc added the Expected Behavior This is how MathJax works label Apr 27, 2015
@mmokrejs
Copy link
Author

Hmm, maybe the comment #1 from https://bugzilla.mozilla.org/show_bug.cgi?id=1158522 could be applied to your code? ;-)

@pkra pkra added the Abandoned label May 7, 2015
@pkra
Copy link
Contributor

pkra commented May 7, 2015

=> closed as "expected behavior" / "abandoned"

@pkra pkra closed this as completed May 7, 2015
@dpvc
Copy link
Member

dpvc commented May 7, 2015

@pkra, the OP's link to bugzilla does give a method of avoiding the message (add an extra set of parentheses), if we wanted to do that. No real harm to it, but the warning message is not something I'm particularly concerned about. If you want to drop it, I'm OK with that, but just wanted to be sure that you knew that there was a simple "fix".

@pkra
Copy link
Contributor

pkra commented May 7, 2015

@dpvc ah, sorry. This sounded similar to requests for supporting strict mode, which I thought was not an option generally speaking. It seemed abandoned and was tagged 'expected behavior'.

Anyway, fixing always sounds nice.

@pkra pkra reopened this May 7, 2015
@pkra pkra added Accepted Issue has been reproduced by MathJax team and removed Abandoned Expected Behavior This is how MathJax works labels May 7, 2015
@pkra pkra added this to the MathJax v2.6 milestone May 7, 2015
@pkra pkra changed the title JavaScript strict warning: http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML, line 19: SyntaxError: test for equality (==) mistyped as assignment (=)? JavaScript strict warning while (match = regex.exec(string)) {...} May 7, 2015
dpvc added a commit to dpvc/MathJax that referenced this issue Jul 8, 2015
dpvc added a commit to dpvc/MathJax that referenced this issue Jul 9, 2015
@dpvc
Copy link
Member

dpvc commented Jul 9, 2015

=> Merged

@dpvc dpvc added Merged Merged into develop branch and removed Ready for Review labels Jul 9, 2015
@dpvc dpvc closed this as completed Jul 9, 2015
@dpvc dpvc added v2.6 Fixed and removed Fixed Merged Merged into develop branch labels Jan 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Issue has been reproduced by MathJax team Fixed Test Not Needed v2.6
Projects
None yet
Development

No branches or pull requests

3 participants