diff --git a/lib/exe/js.php b/lib/exe/js.php
index 634e212072e7c2b395526d0db8d60fcc7792e768..42979eeedcce2d3affcda765a2360321dc209652 100644
--- a/lib/exe/js.php
+++ b/lib/exe/js.php
@@ -301,10 +301,8 @@ function js_compress($s){
                 // now move forward and find the end of it
                 $j = 1;
                 while($s{$i+$j} != '/'){
-                    while( ($s{$i+$j} != '\\') && ($s{$i+$j} != '/')){
-                        $j = $j + 1;
-                    }
                     if($s{$i+$j} == '\\') $j = $j + 2;
+                    else $j++;
                 }
                 $result .= substr($s,$i,$j+1);
                 $i = $i + $j + 1;