Created
April 16, 2012 16:58
-
-
Save Pewpewarrows/2399955 to your computer and use it in GitHub Desktop.
ASI Bug introduced during Concatenation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This library file decides to use ASI everywhere | |
var fn = function () { | |
//... | |
} // semicolon missing at this line |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// My site's code, starting with an IIFE | |
(function () { | |
//... | |
})(); |
I get that, but what you're essentially saying is that everyone else in the community has to add safety guards to their code because you want to use an error correction component of the language to avoid writing some semicolons. You have to admit that it seems completely ass-backwards.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You need to guard against this regardless—this is a common thing even for libraries that use semicolons everywhere.
The best way to do this, is follow the rules I've laid down in my blog post, specifically If your line starts with ( or [ write a single semicolon before that.