(bug 27046) Do not strip newlines following C++-style // comments. Prior to this...
authorRoan Kattouw <catrope@users.mediawiki.org>
Mon, 31 Jan 2011 12:48:08 +0000 (12:48 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Mon, 31 Jan 2011 12:48:08 +0000 (12:48 +0000)
includes/libs/JavaScriptDistiller.php

index ff2a0b2..3e0a00f 100644 (file)
@@ -84,7 +84,8 @@ class JavaScriptDistiller {
                $parser->add( '/[^\\w\\$\\/\'"*)\\?:]\\/[^\\/\\r\\n\\*][^\\/\\r\\n]*\\/g?i?/', '$1' );
                // Remove comments
                $parser->add( '/\\/\\*(.|[\\r\\n])*?\\*\\//' );
-               $parser->add( '/\\/\\/[^\\r\\n]*[\\r\\n]/' );
+               // Preserve the newline after a C++-style comment -- bug 27046
+               $parser->add( '/\\/\\/[^\\r\\n]*([\\r\\n])/', '$2' );
                return $parser;
        }
 }