laxman954 / granule

Automatically exported from code.google.com/p/granule
0 stars 0 forks source link

Corrupted JS - problems with comments vs regex // #17

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. compact a JS library, e.g. jQuery mobile: 
http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js
This is the same like issue #12
2. granule removes all comments with //
3. // is also used for regular expressions, so they are also removed

What is the expected output? What do you see instead?

Expected: return/\//.test(a)},clean:function(a)
Instead stripped: return/\...

What version of the product are you using? On what operating system?
1.0.9

Original issue reported on code.google.com by Karsten....@googlemail.com on 8 Jun 2012 at 9:53

GoogleCodeExporter commented 8 years ago
I added a test to com.granule.tag.utils.JSFastWhiteSpaceRemoverTest:

        test("isPath:function(a){return/\\//.test(a)}", "isPath:function(a){return/\\//.test(a)}");

This one fails:

junit.framework.ComparisonFailure: null 
Expected :isPath:function(a){return/\
Actual   :isPath:function(a){return/\//.test(a)}

Original comment by Karsten....@googlemail.com on 8 Jun 2012 at 10:41