Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7556183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:48:11+00:00 2026-05-30T11:48:11+00:00

What happens to comments in a minified JavaScript file? How can the browser know

  • 0

What happens to comments in a minified JavaScript file? How can the browser know when the end of the comment is when everything is condensed to one line? Take this little example, I have Google tracking code like this:

//Google tracking
var _gaq = _gaq || []; 
_gaq.push(['_setAccount', '123456']); 

The minified version pulls everything into one line

// Google tracking var _gaq = _gaq || []; _gaq.push(['_setAccount', '123456']);

There are more statements, but when I examine the JavaScript code in an editor, it looks like one giant comment (more or less). Is there a hidden character that tells the browser when to end a comment or is this code just not being executed?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T11:48:13+00:00Added an answer on May 30, 2026 at 11:48 am

    Minifiers strip comments or insert line-breaks. For example, Closure Compiler’s FAQ says:

    Can I use the Closure Compiler together with other JavaScript minifiers?

    Yes. Closure Compiler reads in any valid JavaScript and generates valid JavaScript, so you can apply the Closure Compiler to a JavaScript file either before or after you run the file through a different minifier.

    Remember that Closure Compiler and other minifiers might have expectations about the incoming code. A minifier that strips comments may remove licenses or annotation information needed by another tool, for example.

    Sometimes you really need a comment in which case they put in a line break.

    I have copyright notices or open source license text that must appear in my source code. How do I keep the Closure Compiler from stripping this text out?

    Closure Compiler supports the JSDoc @license tag. Add the @license tag to any JSDoc comment to preserve the comment in the compiler output. See Annotating JavaScript for the Closure Compiler for more information.

    Minifiers also tend to break lines occasionally, because some interpreter’s source code parsers crashed or performed really slowly on really long lines.

    https://bugzilla.mozilla.org/show_bug.cgi?id=634444

    Previously, because we were dealing with chunks, there was a limit to how much of a line an error message could include. But now the error message contains the entire line. If you have very long lines and lots of errors, it’s a recipe for high memory usage, especially since we call js_DeflateString() on the error message string, resulting in two copies of it (one made of jschars, the other made of chars).

    On the site in question, heaps of errors occurred on a line containing 122,895 chars, resulting in over 1G of chars (at 3 bytes per char!) being put into error messages.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone show me how to include this javascript file into my wordpress plugin.
What happens to the name/value pairs stored inside a form's resx file? Are they
What happens on a Windows box once you add more drives than can fit
what happens if an user trying to read HttpContext.Current.Cache[key] while the other one trying
What happens if I use SHGetFolderPath api call in a 32 bit system with
What happens to exceptions raised while in myMethod: if it is invoked via NSObject's
What happens when the Office 2003 PIA prerequisite and launch condition in a Windows
This happens repeatedly and is very annoying. I upload some PHP code to a
What happens in the memory when a class instantiates the following object? public class
It happens lot of the time that when you report a bug to a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.