mirror of
https://github.com/matthiasmullie/minify.git
synced 2025-02-24 08:03:54 +01:00
parent
1e59ad8119
commit
31371a6a67
10
src/JS.php
10
src/JS.php
@ -307,6 +307,16 @@ class JS extends Minify
|
|||||||
*/
|
*/
|
||||||
$content = preg_replace('/(for\([^;]*;[^;]*;[^;\{]*\));(\}|$)/s', '\\1;;\\2', $content);
|
$content = preg_replace('/(for\([^;]*;[^;]*;[^;\{]*\));(\}|$)/s', '\\1;;\\2', $content);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We also can't strip empty else-statements. Even though they're
|
||||||
|
* useless and probably shouldn't be in the code in the first place, we
|
||||||
|
* shouldn't be stripping the `;` that follows it as it breaks the code.
|
||||||
|
* We can just remove those useless else-statements completely.
|
||||||
|
*
|
||||||
|
* @see https://github.com/matthiasmullie/minify/issues/91
|
||||||
|
*/
|
||||||
|
$content = preg_replace('/else;/s', '', $content);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We also don't really want to terminate statements followed by closing
|
* We also don't really want to terminate statements followed by closing
|
||||||
* curly braces (which we've ignored completely up until now) or end-of-
|
* curly braces (which we've ignored completely up until now) or end-of-
|
||||||
|
@ -659,6 +659,12 @@ BUG
|
|||||||
"for(;;ja||(ja=!0)){}",
|
"for(;;ja||(ja=!0)){}",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// https://github.com/matthiasmullie/minify/issues/91
|
||||||
|
$tests[] = array(
|
||||||
|
'if(true){if(true)console.log("test")else;}',
|
||||||
|
'if(!0){if(!0)console.log("test")}',
|
||||||
|
);
|
||||||
|
|
||||||
return $tests;
|
return $tests;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user