Don't remove space between a+ ++b

This commit is contained in:
Matthias Mullie 2014-10-10 08:38:18 +02:00
parent 30a742f9d5
commit da1b6a195e
2 changed files with 12 additions and 2 deletions

View File

@ -335,8 +335,8 @@ class JS extends Minify
$operators = array_combine($operators, $escaped);
// make sure + and - can't be mistaken for ++ and --, which are special
$operators['+'] = '(?<!\+)\+(?!\+)';
$operators['-'] = '(?<!\-)\-(?!\-)';
$operators['+'] = '(?<!\+)\+(?!\s*\+)';
$operators['-'] = '(?<!\-)\-(?!\s*\-)';
return $operators;
}

View File

@ -249,6 +249,16 @@ else statement',
'alert("this is a test")',
);
// mix of ++ and +: three consecutive +es will be interpreted as ++ +
$tests[] = array(
'a++ +b',
'a+++b',
);
$tests[] = array(
'a+ ++b',
'a+ ++b',
);
// add comment in between whitespace that needs to be stripped
$tests[] = array(
'object