mirror of
https://github.com/matthiasmullie/minify.git
synced 2025-02-23 11:03:08 +01:00
Shorten while(true) to for(;;)
This commit is contained in:
parent
ecd1a04d88
commit
2a70744313
@ -415,6 +415,9 @@ class JS extends Minify
|
||||
$content = preg_replace('/\btrue\b/', '!0', $content);
|
||||
$content = preg_replace('/\bfalse\b/', '!1', $content);
|
||||
|
||||
// for(;;) is exactly the same as while(true)
|
||||
$content = preg_replace('/\bwhile\(!0\)/', 'for(;;)', $content);
|
||||
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
|
@ -388,6 +388,12 @@ if(e.which==40&&index<$items.length-1)index++',
|
||||
'array["dont-replace"].key2',
|
||||
);
|
||||
|
||||
// shorten bools
|
||||
$tests[] = array(
|
||||
'while(true){break}',
|
||||
'for(;;){break}',
|
||||
);
|
||||
|
||||
// https://github.com/matthiasmullie/minify/issues/10
|
||||
$tests[] = array(
|
||||
'// first mutation patch
|
||||
|
Loading…
x
Reference in New Issue
Block a user