From: Richard Gibson Date: Wed, 23 Jan 2013 22:42:28 +0000 (-0500) Subject: Fix #13274: Wrap sourceMap directive in multiline comments. Close gh-1143. X-Git-Tag: 1.9.1~22 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ac93559eb9f18fcaec95dfdc97358b1b85bfe234;p=jquery.git Fix #13274: Wrap sourceMap directive in multiline comments. Close gh-1143. --- diff --git a/Gruntfile.js b/Gruntfile.js index 5b45547ff..5ad39bf02 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -409,7 +409,7 @@ module.exports = function( grunt ) { nonascii = false; distpaths.forEach(function( filename ) { - var i, c, + var i, c, map, text = fs.readFileSync( filename, "utf8" ); // Ensure files use only \n for line endings, not \r\n @@ -438,7 +438,18 @@ module.exports = function( grunt ) { text = text.replace( /"dist\//g, "\"" ); fs.writeFileSync( filename, text, "utf-8" ); } else if ( /\.min\.js$/.test( filename ) ) { - text = text.replace( /sourceMappingURL=dist\//, "sourceMappingURL=" ); + // Wrap sourceMap directive in multiline comments (#13274) + text = text.replace( /\n?(\/\/@\s*sourceMappingURL=)(.*)/, + function( _, directive, path ) { + map = "\n" + directive + path.replace( /^dist\//, "" ); + return ""; + }); + if ( map ) { + text = text.replace( /(^\/\*[\w\W]*?)\s*\*\/|$/, + function( _, comment ) { + return ( comment || "\n/*" ) + map + "\n*/"; + }); + } fs.writeFileSync( filename, text, "utf-8" ); } diff --git a/test/data/core/cc_on.html b/test/data/core/cc_on.html new file mode 100644 index 000000000..88bb01029 --- /dev/null +++ b/test/data/core/cc_on.html @@ -0,0 +1,22 @@ + + + + + + + + + + + diff --git a/test/unit/core.js b/test/unit/core.js index f7612896f..373373185 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -17,6 +17,13 @@ test("Basic requirements", function() { ok( $, "$" ); }); +testIframeWithCallback( "Conditional compilation compatibility (#13274)", "core/cc_on.html", function( cc_on, errors, $ ) { + expect( 3 ); + ok( true, "JScript conditional compilation " + ( cc_on ? "supported" : "not supported" ) ); + deepEqual( errors, [], "No errors" ); + ok( $(), "jQuery executes" ); +}); + test("jQuery()", function() { var elem, i,