mishoo/UglifyJS — Issue #269: embedToken mode breaks jQuery 1.6.2
Author: tonyarkles
Created: 2011-12-07 02:21:16+00:00
State: open

I worked around the issue in #268 by forcing parens RHS parens (process.js:1688), but I'm still having trouble. When I process jquery 1.6.2 using this code:

```

var jsp = require("uglify-js").parser;
var pro = require("uglify-js").uglify;
var fs = require('fs');
var input = fs.readFileSync('./jquery-1.6.2.js').toString();

var ast = jsp.parse(input, false, true);
var code = pro.gen_code(ast, { beautify: true });
console.log(code);
```

The resulting jQuery library gives me this error:
```
jquery-beauty-nofix-token-testcase.js:481
Uncaught TypeError: Object function (selector, context) {
return new jQuery.fn.init(selector, context, rootjQuery);
} has no method 'each'
```

If I process it without using embedTokens, i.e. using this code:

```

var jsp = require("uglify-js").parser;
var pro = require("uglify-js").uglify;
var fs = require('fs');
var input = fs.readFileSync('./jquery-1.6.2.js').toString();

var ast = jsp.parse(input, false, false);
var code = pro.gen_code(ast, { beautify: true });
console.log(code);
```

Then the output works fine. Unfortunately, I need embedToken for what I'm working on. I'm not really sure where to start for debugging this though.