diff --git a/_test/cases/lib/exe/js_js_compress.test.php b/_test/cases/lib/exe/js_js_compress.test.php
index f46cbe227b4c4596fd4f9881fc8f07d24f199bf6..20ad88210522964e63b7769777e2542228636827 100644
--- a/_test/cases/lib/exe/js_js_compress.test.php
+++ b/_test/cases/lib/exe/js_js_compress.test.php
@@ -49,6 +49,11 @@ class js_js_compress_test extends UnitTestCase {
         $this->assertEqual(js_compress($text), $text);
     }
 
+    function test_dquot2(){
+        $text = 'var foo="Now what \\\\\\" \'do we//get /*here*/ ?";';
+        $this->assertEqual(js_compress($text), $text);
+    }
+
     function test_dquotrunaway(){
         $text = 'var foo="Now where does it end';
         $this->assertEqual(js_compress($text), "$text\n"); //\n is added by compressor
diff --git a/lib/exe/js.php b/lib/exe/js.php
index 9854f1b459ecae7d2ac1a7b5a5f8cbfdfcad2d2e..e01ab7bf523336670f3c8aeffc092f582a41aad0 100644
--- a/lib/exe/js.php
+++ b/lib/exe/js.php
@@ -290,7 +290,7 @@ function js_compress($s){
         if($ch == '"'){
             $j = 1;
             while( $s{$i+$j} != '"' && ($i+$j < $len)){
-                if( $s{$i+$j} == '\\' && $s{$i+$j+1} == '"' ){
+                if( $s{$i+$j} == '\\' && ($s{$i+$j+1} == '"' || $s{$i+$j+1} == '\\') ){
                     $j += 2;
                 }else{
                     $j += 1;
@@ -305,7 +305,7 @@ function js_compress($s){
         if($ch == "'"){
             $j = 1;
             while( $s{$i+$j} != "'" && ($i+$j < $len)){
-                if( $s{$i+$j} == '\\' && $s{$i+$j+1} == "'" ){
+                if( $s{$i+$j} == '\\' && ($s{$i+$j+1} == "'" || $s{$i+$j+1} == '\\') ){
                     $j += 2;
                 }else{
                     $j += 1;