Title: JS Inline Comments Causing Error?
Last modified: May 23, 2017

---

# JS Inline Comments Causing Error?

 *  [wooncherk](https://wordpress.org/support/users/wooncherk/)
 * (@wooncherk)
 * [9 years ago](https://wordpress.org/support/topic/js-inline-comments-causing-error/)
 * If there’s inline comment in the JavaScript, it may break the code.
 * Say there are 2 files:
 * `alert('test'); // inline comment`
 * and
 * `alert('test2');`
 * There is a possibility that AO will combine the files into:
 * `alert('test'); // inline comment alert('test2');`
 * This breaks the 2nd file. Can JS inline comment be removed?

Viewing 10 replies - 1 through 10 (of 10 total)

 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [9 years ago](https://wordpress.org/support/topic/js-inline-comments-causing-error/#post-9161107)
 * well, that would be my first remark; inline comments normally do get removed?
   isn’t that the case for you?
 *  Thread Starter [wooncherk](https://wordpress.org/support/users/wooncherk/)
 * (@wooncherk)
 * [9 years ago](https://wordpress.org/support/topic/js-inline-comments-causing-error/#post-9161150)
 * No it doen’t in my case.
 * Here’s the culprit file: [https://simplymyhair-4a27.kxcdn.com/wp-content/plugins/feed-them-social/admin/js/admin.js?ver=4.7.5](https://simplymyhair-4a27.kxcdn.com/wp-content/plugins/feed-them-social/admin/js/admin.js?ver=4.7.5)(
   from plugin Feed Them Social)
 * And this is the generated file: [https://1drv.ms/u/s!AoJO8z-oV8zek8owzrCCPtMP9vYBvg](https://1drv.ms/u/s!AoJO8z-oV8zek8owzrCCPtMP9vYBvg)(
   search for **// end of form.submit** and you’ll see it breaks the code)
    -  This reply was modified 9 years ago by [wooncherk](https://wordpress.org/support/users/wooncherk/).
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [9 years ago](https://wordpress.org/support/topic/js-inline-comments-causing-error/#post-9162466)
 * But I don’t see a comment in [https://simplymyhair-4a27.kxcdn.com/wp-content/plugins/feed-them-social/admin/js/admin.js?ver=4.7.5](https://simplymyhair-4a27.kxcdn.com/wp-content/plugins/feed-them-social/admin/js/admin.js?ver=4.7.5)
   [@wooncherk](https://wordpress.org/support/users/wooncherk/) ?
 *  Thread Starter [wooncherk](https://wordpress.org/support/users/wooncherk/)
 * (@wooncherk)
 * [9 years ago](https://wordpress.org/support/topic/js-inline-comments-causing-error/#post-9162817)
 * Sorry, I had to remove the comments to make it work. The original file is at:
 * [https://simplymyhair-4a27.kxcdn.com/wp-content/plugins/feed-them-social/admin/js/admin.old.js?ver=4.7.5](https://simplymyhair-4a27.kxcdn.com/wp-content/plugins/feed-them-social/admin/js/admin.old.js?ver=4.7.5)
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [9 years ago](https://wordpress.org/support/topic/js-inline-comments-causing-error/#post-9162833)
 * OK, and when the comments are there, are they all retained after minification,
   or only the last one?
 *  Thread Starter [wooncherk](https://wordpress.org/support/users/wooncherk/)
 * (@wooncherk)
 * [9 years ago](https://wordpress.org/support/topic/js-inline-comments-causing-error/#post-9162856)
 * You can see a copy of the generated file here: [https://1drv.ms/u/s!AoJO8z-oV8zek8owzrCCPtMP9vYBvg](https://1drv.ms/u/s!AoJO8z-oV8zek8owzrCCPtMP9vYBvg).
   Search for these comments:
 * `// end of ajax()`
 * `// end of document.ready`
 * `// end of form.submit`
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [9 years ago](https://wordpress.org/support/topic/js-inline-comments-causing-error/#post-9162931)
 * the weird thing is that in that autoptimized file that piece of code is in fact
   _not_ minified at all, which explains why those comments are there.
 * let me try to reproduce that …
 *  Thread Starter [wooncherk](https://wordpress.org/support/users/wooncherk/)
 * (@wooncherk)
 * [9 years ago](https://wordpress.org/support/topic/js-inline-comments-causing-error/#post-9163097)
 * Sure. And the plugin in question is Feed Them Social. 🙂
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [9 years ago](https://wordpress.org/support/topic/js-inline-comments-causing-error/#post-9163220)
 * OK;
    1. I can reproduce the specific JS not being optimized, no idea yet why 
   I’m afraid 2. in the [upcoming AO2.2](https://wordpress.org/support/topic/autoptimize-2-2-is-near-need-testers/)
   this does not trigger JS errors, as there’s newline after each optimized file
 * next steps:
    1. I’ll look into why that part of the code is not optimized. 2.
   could you [check out AO2.2](https://wordpress.org/support/topic/autoptimize-2-2-is-near-need-testers/)
   to see if this at least stops the resulting JS errors?
 * frank
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [9 years ago](https://wordpress.org/support/topic/js-inline-comments-causing-error/#post-9163316)
 * oh, as a workaround adding `feed-them-social/admin/js/admin.js` to the JS optimization
   exclusions list would obviously also work.

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘JS Inline Comments Causing Error?’ is closed to new replies.

 * ![](https://ps.w.org/autoptimize/assets/icon-256X256.png?rev=2211608)
 * [Autoptimize](https://wordpress.org/plugins/autoptimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/autoptimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/autoptimize/)
 * [Active Topics](https://wordpress.org/support/plugin/autoptimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/autoptimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/autoptimize/reviews/)

 * 10 replies
 * 2 participants
 * Last reply from: [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * Last activity: [9 years ago](https://wordpress.org/support/topic/js-inline-comments-causing-error/#post-9163316)
 * Status: not resolved