Description
Tagged template literals are commonly used by web components libraries. They can also include CSS code, HTML code and embedded expressions (a.k.a. substitutions).
The problem
ES sometimes abuses the string-tightness of the CSS and HTML comments when those exist within tagged template literals. This is done when comments, for some reason, include expressions and basktick (`).
Examples
Please, have a look at the following links:
-
Expressions within HTML Comment - Hint for beginners Β· Discussion #2167 Β· lit/lit Β· GitHub
-
Expressions within CSS Comment - Hint for beginners Β· Discussion #2202 Β· lit/lit Β· GitHub
Solution
Ξ new method has to be adopted which will instruct the ES parser on the fly to consider a string as ES comment, although it is not marked as a such one, and ignore it.
Note
I do not know if ES does explicitly or implicitly interfere with other languages (apart from CSS, HTML), but general speaking, developers may conditionally use such a technique to ensure that features of one language do not interfere with those of another one.