plan B for IE8 do-while semi-colon fix (#1572)
- omitting trailing semi-colon in do-while breaks non-browser parser, e.g. uglify-js 1.x - trailing semi-colon only breaks IE8 if followed by `else` or `while` - always use braces in do-while body to workaround 2nd case with no size loss in compression fixes #1568
This commit is contained in:
@@ -257,7 +257,7 @@ issue_186: {
|
||||
else
|
||||
bar();
|
||||
}
|
||||
expect_exact: 'var x=3;if(foo())do do alert(x);while(--x)while(x)else bar();'
|
||||
expect_exact: 'var x=3;if(foo())do{do{alert(x)}while(--x)}while(x);else bar();'
|
||||
}
|
||||
|
||||
issue_186_ie8: {
|
||||
@@ -276,7 +276,7 @@ issue_186_ie8: {
|
||||
else
|
||||
bar();
|
||||
}
|
||||
expect_exact: 'var x=3;if(foo())do do alert(x);while(--x)while(x)else bar();'
|
||||
expect_exact: 'var x=3;if(foo()){do{do{alert(x)}while(--x)}while(x)}else bar();'
|
||||
}
|
||||
|
||||
issue_186_beautify: {
|
||||
@@ -295,7 +295,7 @@ issue_186_beautify: {
|
||||
else
|
||||
bar();
|
||||
}
|
||||
expect_exact: 'var x = 3;\n\nif (foo()) do do alert(x); while (--x); while (x); else bar();'
|
||||
expect_exact: 'var x = 3;\n\nif (foo()) do {\n do {\n alert(x);\n } while (--x);\n} while (x); else bar();'
|
||||
}
|
||||
|
||||
issue_186_beautify_ie8: {
|
||||
@@ -314,7 +314,7 @@ issue_186_beautify_ie8: {
|
||||
else
|
||||
bar();
|
||||
}
|
||||
expect_exact: 'var x = 3;\n\nif (foo()) do do alert(x); while (--x) while (x) else bar();'
|
||||
expect_exact: 'var x = 3;\n\nif (foo()) {\n do {\n do {\n alert(x);\n } while (--x);\n } while (x);\n} else bar();'
|
||||
}
|
||||
|
||||
issue_186_bracketize: {
|
||||
@@ -394,5 +394,5 @@ issue_186_beautify_bracketize_ie8: {
|
||||
else
|
||||
bar();
|
||||
}
|
||||
expect_exact: 'var x = 3;\n\nif (foo()) {\n do {\n do {\n alert(x);\n } while (--x)\n } while (x)\n} else {\n bar();\n}'
|
||||
expect_exact: 'var x = 3;\n\nif (foo()) {\n do {\n do {\n alert(x);\n } while (--x);\n } while (x);\n} else {\n bar();\n}'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user