This commit is contained in:
Ben Toews 2015-09-14 17:45:09 +00:00
commit 83c50da63d
4 changed files with 26 additions and 0 deletions

View File

@ -354,6 +354,9 @@ to set `true`; it's effectively a shortcut for `foo=true`).
compressor from mangling/discarding function names. Useful for code relying on
`Function.prototype.name`.
- `ascii-only` -- default `false`. Escape Unicode characters in strings and
regexps.
### The `unsafe` option

View File

@ -225,6 +225,9 @@ if (ARGS.keep_fnames) {
if (BEAUTIFY)
UglifyJS.merge(OUTPUT_OPTIONS, BEAUTIFY);
if (COMPRESS)
OUTPUT_OPTIONS.ascii_only = !!COMPRESS.ascii_only
if (ARGS.comments != null) {
if (/^\/.*\/[a-zA-Z]*$/.test(ARGS.comments)) {
try {

View File

@ -74,6 +74,7 @@ function Compressor(options, false_by_default) {
screw_ie8 : false,
drop_console : false,
angular : false,
ascii_only : false,
warnings : true,
global_defs : {}

View File

@ -0,0 +1,19 @@
prevents_unicode_escape_sequences_from_being_converted: {
options = {ascii_only: true};
input: {
var a = "\u2000";
}
expect: {
var a = "\u2000";
}
}
converts_unicode_characters_to_escape_sequences: {
options = {ascii_only: true};
input: {
var a = " ";
}
expect: {
var a = "\u2000";
}
}