Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix #13274: wrap sourceMap directive in multiline comments #1143

Closed
wants to merge 2 commits into from

3 participants

@gibson042
Collaborator

Sizes - compared to 1.9-stable @ 21af3a9

    267328         (-)  dist/jquery.js                                         
    138252         (-)  dist/jquery.min.map                                    
     92988         (-)  dist/jquery.min.js                                     
     32963        (-1)  dist/jquery.min.js.gz
@dmethvin
Owner

Sweet! You need to add cc_on.html to the PR.

@gibson042
Collaborator

Details, details...

@jaubourg
Collaborator

@gibson042 old people are obsessed with details!

/me hides from @dmethvin's wrath

@dmethvin
Owner

What in tarnation?! You boys get off my lawn!

@gibson042
Collaborator

After you give us back our ball, mister!

@jaubourg
Collaborator

Look, sir, we didn't drop the ball... @danheberden did... as usual... :/

@gibson042 gibson042 closed this in 487b703
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 23, 2013
  1. @gibson042
Commits on Jan 24, 2013
  1. @gibson042

    Include new file

    gibson042 authored
This page is out of date. Refresh to see the latest.
Showing with 42 additions and 2 deletions.
  1. +13 −2 Gruntfile.js
  2. +22 −0 test/data/core/cc_on.html
  3. +7 −0 test/unit/core.js
View
15 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" );
}
View
22 test/data/core/cc_on.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <script>
+ var cc_on = false,
+ errors = [];
+/*@cc_on
+ cc_on = true;
+@*/
+ window.onerror = function( errorMessage, filePath, lineNumber ) {
+ errors.push( errorMessage );
+ };
+ </script>
+ <script src="../../../dist/jquery.min.js"></script>
+</head>
+<body>
+ <script>
+ window.parent.iframeCallback( cc_on, errors, jQuery );
+ </script>
+</body>
+</html>
View
7 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,
Something went wrong with that request. Please try again.