From 004de6d537b22ba976bd4f8b69268aed460530df Mon Sep 17 00:00:00 2001 From: Juriy Zaytsev Date: Tue, 9 Mar 2010 10:02:15 -0500 Subject: [PATCH] Delete JS comment delimeters before HTML comment delimeters in scripts. --- src/htmlminifier.js | 9 +++++++-- tests/index.html | 4 ++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/htmlminifier.js b/src/htmlminifier.js index 26a88b0..bc3db26 100644 --- a/src/htmlminifier.js +++ b/src/htmlminifier.js @@ -104,11 +104,16 @@ } var reStartDelimiter = { - 'script': /^\s*\s*$/, + 'style': /\s*-->\s*$/ + }; function removeComments(text, tag) { - return text.replace(reStartDelimiter[tag], '').replace(/\s*-->\s*$/, ''); + return text.replace(reStartDelimiter[tag], '').replace(reEndDelimiter[tag], ''); } function isOptionalTag(tag) { diff --git a/tests/index.html b/tests/index.html index 28efcd6..c0f8e37 100644 --- a/tests/index.html +++ b/tests/index.html @@ -126,6 +126,10 @@ input = '