diff --git a/packages/@lwc/engine-server/src/serializer.ts b/packages/@lwc/engine-server/src/serializer.ts index 9b455b0978..1e7631a6a2 100644 --- a/packages/@lwc/engine-server/src/serializer.ts +++ b/packages/@lwc/engine-server/src/serializer.ts @@ -108,7 +108,6 @@ function serializeTextContent(contents: string, tagName?: string) { if (tagName === 'style') { // Special validation for `. + * + * This also means that we cannot use "normal" HTML escaping inside ``, - * since a user could use that inside of a *.css file to break out of a ') // Throws */ export function validateStyleTextContents(contents: string): void { - // If parse5 parses this as more than one ``); - - if (!isSingleStyleNodeContainingSingleTextNode(fragment)) { + if (INVALID_STYLE_CONTENT.test(contents)) { throw new Error( 'CSS contains unsafe characters and cannot be serialized inside a style element' );