Merge ea17a0771a into 20542a37a8
This commit is contained in:
commit
83c50da63d
|
|
@ -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
|
compressor from mangling/discarding function names. Useful for code relying on
|
||||||
`Function.prototype.name`.
|
`Function.prototype.name`.
|
||||||
|
|
||||||
|
- `ascii-only` -- default `false`. Escape Unicode characters in strings and
|
||||||
|
regexps.
|
||||||
|
|
||||||
|
|
||||||
### The `unsafe` option
|
### The `unsafe` option
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -225,6 +225,9 @@ if (ARGS.keep_fnames) {
|
||||||
if (BEAUTIFY)
|
if (BEAUTIFY)
|
||||||
UglifyJS.merge(OUTPUT_OPTIONS, BEAUTIFY);
|
UglifyJS.merge(OUTPUT_OPTIONS, BEAUTIFY);
|
||||||
|
|
||||||
|
if (COMPRESS)
|
||||||
|
OUTPUT_OPTIONS.ascii_only = !!COMPRESS.ascii_only
|
||||||
|
|
||||||
if (ARGS.comments != null) {
|
if (ARGS.comments != null) {
|
||||||
if (/^\/.*\/[a-zA-Z]*$/.test(ARGS.comments)) {
|
if (/^\/.*\/[a-zA-Z]*$/.test(ARGS.comments)) {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,7 @@ function Compressor(options, false_by_default) {
|
||||||
screw_ie8 : false,
|
screw_ie8 : false,
|
||||||
drop_console : false,
|
drop_console : false,
|
||||||
angular : false,
|
angular : false,
|
||||||
|
ascii_only : false,
|
||||||
|
|
||||||
warnings : true,
|
warnings : true,
|
||||||
global_defs : {}
|
global_defs : {}
|
||||||
|
|
|
||||||
19
test/compress/ascii_only.js
Normal file
19
test/compress/ascii_only.js
Normal 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";
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user