As many of us know, IE7 is not quite friendly with JavaScript code containing trailing mas, which can be a large problem for projects using modern JS framerworks and containing a lot of JS code. In a pretty good article on the subject, the author mentions:
On the tools front, my preference for bating these devils is the Eclipse JavaScript Development Tools. The JavaScript source editor in JSDT flags trailing mas as errors: .png
However, using Eclipse Indigo with WTP/JSDT, I'm not seeing trailing mas as errors, and I can't find a proper setting to fix this.
How do I setup Eclipse to flag trailing mas in JavaScript as errors?
As many of us know, IE7 is not quite friendly with JavaScript code containing trailing mas, which can be a large problem for projects using modern JS framerworks and containing a lot of JS code. In a pretty good article on the subject, the author mentions:
On the tools front, my preference for bating these devils is the Eclipse JavaScript Development Tools. The JavaScript source editor in JSDT flags trailing mas as errors: http://www.enterprisedojo./wp-content/uploads/2010/12/jsdtRules.png
However, using Eclipse Indigo with WTP/JSDT, I'm not seeing trailing mas as errors, and I can't find a proper setting to fix this.
How do I setup Eclipse to flag trailing mas in JavaScript as errors?
Share Improve this question asked Sep 11, 2011 at 22:32 DasDas 3172 gold badges8 silver badges14 bronze badges 1- I would expect it to be in Preferences under JavaScript -> Validator -> Errors/Warnings with the other similar options, but it's not. – Sam Hanes Commented Jan 25, 2012 at 22:02
3 Answers
Reset to default 3It looks like the fix for another bug involving erroneous syntax errors on the ma operator also removed the syntax error on trailing mas in initializers. That's technically correct; the standard says they're allowed and IE7 is just nonconformant. There's a feature request open asking that they be reinstated.
Slightly off topic, but you should also look into using JSLint to check the syntax of the JavaScript code. It will warn you about the trailing ma, but also about many other potential problems. There is a good plugin for Eclipse, http://marketplace.eclipse/content/phonegap-android-jslintjshint. The instructions for setting it up: http://www.mobiledevelopersolutions./home/announce-1/mds12released-nowwithjslintjshint
Make sure you're in the correct perspective (ie JavaScript as opposed to Java).
Also, I found in Helios that if I added a JS file to the project by right-clicking and adding a new 'File' (which I would then name with a .js extension) didn't make the UI pick up that it should be treated as a JS file--no syntax highlighting, checking, etc. If I added it specifically using the new JavaScript file option, it worked fine.