Comments are not always stripped when compressing
The following input:
if ( /*is.ns5 &&*/ subDivs[idx].className=='DLG_edittext' && subDivs[idx].style.width ) // fix firefox bug
button152.enable(bMode&&bEdit/*TODO &&theApp.clipboard.canPaste(theApp.clipboard.titleData.title.arChld[0])*/); //
var testFunc = function(tempNode) {
var fs = tempNode.style.fontSize;
fs = parseInt(fs); //.substr(0,fs.length-2); // remove px
fs = Math.round( fs / 1.3333 ) + "pt"; // convert to points
var bs = fs * 2;
return bs
}
Outputs like this:
if (/*is.ns5&&*/ subDivs[idx].className=='DLG_edittext' && subDivs[idx].style.width ) //fix firefox bug button152.enable(bMode&&bEdit/*TODO&&theApp.clipboard.canPaste(theApp.clipboard.titleData.title.arChld[0])*/); //var testFunc=function(A) {var B=A.style.fontSize;B=parseInt(B);B=Math.round(B / 1.3333 ) + "pt"; //convert to points var C=B*2;return C};
The comments have not been stripped out, breaking the code in some cases.
The problem here is in the regex used to isolate and save strings and regular expressions. It was not looking for the "*" char before "/" in the regular expression start.
There is also a big problem with the division literal (/). In the following example:
The processor was considering
/ b /
as a regular expression.There would be possible to solve this problem, but PHP doesn't support flexible length on lookbehind assertions. So, the patch also includes two further assertions that impose some rules for regular expressions and divisions:
a/b/g
", "/b/
" is considered a regular expression.