Compare commits

...

5 Commits

Author SHA1 Message Date
Mihai Bazon
bf7b122ab2 v2.4.12 2014-01-26 10:11:00 +02:00
Mihai Bazon
e29048b54a Merge branch 'master' of github.com:mishoo/UglifyJS2 2014-01-26 10:07:10 +02:00
Mihai Bazon
2eeb640eca Merge pull request #408 from danielstutzman/escape-null-in-regex
Don't unescape \x00 in regexes (it breaks IE8)
2014-01-26 00:06:19 -08:00
Mihai Bazon
ceb200fe81 Move unescaping regexps under a codegen option (unescape_regexps) 2014-01-26 10:05:55 +02:00
Daniel Stutzman
f5f8239057 Don't unescape \x00 in regexes (it breaks IE8) 2014-01-25 11:55:39 -07:00
2 changed files with 20 additions and 18 deletions

View File

@@ -46,22 +46,23 @@
function OutputStream(options) { function OutputStream(options) {
options = defaults(options, { options = defaults(options, {
indent_start : 0, indent_start : 0,
indent_level : 4, indent_level : 4,
quote_keys : false, quote_keys : false,
space_colon : true, space_colon : true,
ascii_only : false, ascii_only : false,
inline_script : false, unescape_regexps : false,
width : 80, inline_script : false,
max_line_len : 32000, width : 80,
beautify : false, max_line_len : 32000,
source_map : null, beautify : false,
bracketize : false, source_map : null,
semicolons : true, bracketize : false,
comments : false, semicolons : true,
preserve_line : false, comments : false,
screw_ie8 : false, preserve_line : false,
preamble : null, screw_ie8 : false,
preamble : null,
}, true); }, true);
var indentation = 0; var indentation = 0;
@@ -1140,6 +1141,7 @@ function OutputStream(options) {
0x21 , // ! 0x21 , // !
0x0a , // \n 0x0a , // \n
0x0d , // \r 0x0d , // \r
0x00 , // \0
0xfeff , // Unicode BOM 0xfeff , // Unicode BOM
0x2028 , // unicode "line separator" 0x2028 , // unicode "line separator"
0x2029 , // unicode "paragraph separator" 0x2029 , // unicode "paragraph separator"
@@ -1150,7 +1152,7 @@ function OutputStream(options) {
var str = self.getValue().toString(); var str = self.getValue().toString();
if (output.option("ascii_only")) { if (output.option("ascii_only")) {
str = output.to_ascii(str); str = output.to_ascii(str);
} else { } else if (output.option("unescape_regexps")) {
str = str.split("\\\\").map(function(str){ str = str.split("\\\\").map(function(str){
return str.replace(/\\u[0-9a-fA-F]{4}|\\x[0-9a-fA-F]{2}/g, function(s){ return str.replace(/\\u[0-9a-fA-F]{4}|\\x[0-9a-fA-F]{2}/g, function(s){
var code = parseInt(s.substr(2), 16); var code = parseInt(s.substr(2), 16);

View File

@@ -3,7 +3,7 @@
"description": "JavaScript parser, mangler/compressor and beautifier toolkit", "description": "JavaScript parser, mangler/compressor and beautifier toolkit",
"homepage": "http://lisperator.net/uglifyjs", "homepage": "http://lisperator.net/uglifyjs",
"main": "tools/node.js", "main": "tools/node.js",
"version": "2.4.11", "version": "2.4.12",
"engines": { "node" : ">=0.4.0" }, "engines": { "node" : ">=0.4.0" },
"maintainers": [{ "maintainers": [{
"name": "Mihai Bazon", "name": "Mihai Bazon",