From b14f416a5bf168a8d8e021ad94e0e3729bb848c6 Mon Sep 17 00:00:00 2001 From: Santi Albo Date: Mon, 15 Apr 2024 10:48:25 +0200 Subject: [PATCH] fix: fix downlevel-revealed closing comment being deleted in safe mode --- lib/helpers.mjs | 3 ++- test/modules/minifyConditionalComments.mjs | 2 +- test/modules/removeComments.mjs | 8 ++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/helpers.mjs b/lib/helpers.mjs index 07f0a43..f0e07af 100644 --- a/lib/helpers.mjs +++ b/lib/helpers.mjs @@ -24,7 +24,8 @@ export function isComment(content) { } export function isConditionalComment(content) { - return (content || '').trim().startsWith(''; } export function isStyleNode(node) { diff --git a/test/modules/minifyConditionalComments.mjs b/test/modules/minifyConditionalComments.mjs index a5050ab..7b9efcf 100644 --- a/test/modules/minifyConditionalComments.mjs +++ b/test/modules/minifyConditionalComments.mjs @@ -41,7 +41,7 @@ describe('minifyConditionalComments', () => {
`, - multipleConditionalCommentMinified: '
', + multipleConditionalCommentMinified: '
', singleLineMultipleConditionalComment: `
`, htmlTagIncludedConditionalComment: ` diff --git a/test/modules/removeComments.mjs b/test/modules/removeComments.mjs index b1a203a..3f250cb 100644 --- a/test/modules/removeComments.mjs +++ b/test/modules/removeComments.mjs @@ -33,6 +33,14 @@ describe('removeComments', () => { ); }); + it('should not remove conditional comments ..', () => { + return init( + '', + '', + options + ); + }); + it('should not remove conditional comments ', () => { return init( '',