Skip to content

Commit

Permalink
Merge pull request #789 from kangax/uglify-js-2.8.0
Browse files Browse the repository at this point in the history
uglify-js 2.8.0
  • Loading branch information
alexlamsl authored Feb 28, 2017
2 parents 27d8341 + a6a7897 commit 9ee7d2e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"ncname": "1.0.x",
"param-case": "2.1.x",
"relateurl": "0.2.x",
"uglify-js": "2.7.x"
"uglify-js": "2.8.x"
},
"devDependencies": {
"grunt": "1.0.x",
Expand Down
10 changes: 5 additions & 5 deletions tests/minifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -1911,27 +1911,27 @@ QUnit.test('script minification', function(assert) {
assert.equal(minify(input, { minifyJS: true }), input);

input = '<script>(function(){ var foo = 1; var bar = 2; alert(foo + " " + bar); })()</script>';
output = '<script>!function(){var a=1,n=2;alert(a+" "+n)}()</script>';
output = '<script>!function(){alert("1 2")}()</script>';

assert.equal(minify(input, { minifyJS: true }), output);

input = '<script type="text/JavaScript">(function(){ var foo = 1; var bar = 2; alert(foo + " " + bar); })()</script>';
output = '<script type="text/JavaScript">!function(){var a=1,n=2;alert(a+" "+n)}()</script>';
output = '<script type="text/JavaScript">!function(){alert("1 2")}()</script>';

assert.equal(minify(input, { minifyJS: true }), output);

input = '<script type="application/javascript;version=1.8">(function(){ var foo = 1; var bar = 2; alert(foo + " " + bar); })()</script>';
output = '<script type="application/javascript;version=1.8">!function(){var a=1,n=2;alert(a+" "+n)}()</script>';
output = '<script type="application/javascript;version=1.8">!function(){alert("1 2")}()</script>';

assert.equal(minify(input, { minifyJS: true }), output);

input = '<script type=" application/javascript ; charset=utf-8 ">(function(){ var foo = 1; var bar = 2; alert(foo + " " + bar); })()</script>';
output = '<script type="application/javascript;charset=utf-8">!function(){var a=1,n=2;alert(a+" "+n)}()</script>';
output = '<script type="application/javascript;charset=utf-8">!function(){alert("1 2")}()</script>';

assert.equal(minify(input, { minifyJS: true }), output);

input = '<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({\'gtm.start\':new Date().getTime(),event:\'gtm.js\'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!=\'dataLayer\'?\'&l=\'+l:\'\';j.async=true;j.src=\'//www.googletagmanager.com/gtm.js?id=\'+i+dl;f.parentNode.insertBefore(j,f);})(window,document,\'script\',\'dataLayer\',\'GTM-67NT\');</script>';
output = '<script>!function(w,d,s,l,i){w[l]=w[l]||[],w[l].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl="dataLayer"!=l?"&l="+l:"";j.async=!0,j.src="//www.googletagmanager.com/gtm.js?id="+i+dl,f.parentNode.insertBefore(j,f)}(window,document,"script","dataLayer","GTM-67NT")</script>';
output = '<script>!function(w,d,s,l,i){w[l]=w[l]||[],w[l].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var f=d.getElementsByTagName(s)[0],j=d.createElement(s);j.async=!0,j.src="//www.googletagmanager.com/gtm.js?id=GTM-67NT",f.parentNode.insertBefore(j,f)}(window,document,"script","dataLayer","GTM-67NT")</script>';

assert.equal(minify(input, { minifyJS: { mangle: false } }), output);

Expand Down

0 comments on commit 9ee7d2e

Please sign in to comment.