diff --git a/public/js/lib/loop-protect/loop-protect.js b/public/js/lib/loop-protect/loop-protect.js index 341fb6fa5f..ac3376b6e1 100644 --- a/public/js/lib/loop-protect/loop-protect.js +++ b/public/js/lib/loop-protect/loop-protect.js @@ -50,7 +50,6 @@ if (typeof DEBUG === 'undefined') { DEBUG = true; } var openPos = -1; do { - j -= 1; DEBUG && debug('looking backwards ' + lines[j]); // jshint ignore:line closePos = lines[j].indexOf('*/'); openPos = lines[j].indexOf('/*'); @@ -59,6 +58,11 @@ if (typeof DEBUG === 'undefined') { DEBUG = true; } closeCommentTags++; } + // check for single line /* comment */ formatted comments + if (closePos === lines[j].length - 2 && openPos !== -1) { + closeCommentTags--; + } + if (openPos !== -1) { closeCommentTags--; @@ -67,6 +71,7 @@ if (typeof DEBUG === 'undefined') { DEBUG = true; } return true; } } + j -= 1; } while (j !== 0); return false;