You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Lint: warn when {{ }} is placed directly inside <svg> or <math> #160
A {{ }} interpolation always inserts text. Placed directly inside an <svg> (or <math>), the text is escaped, so an author who passes SVG markup this way gets the markup shown as literal text instead of a drawing:
<svg viewBox="0 0 24 24">{{ icon_markup }}</svg>
The page then shows <path d="..."> as text, both in the server-rendered HTML and after Vue takes over, because Vue's own renderer escapes it the same way. Nothing reports the mistake: there is no hydration mismatch and no console warning.
Citry UI shipped this bug in five components during the Vue migration (fixed in #137): the accordion, disclosure and menu chevrons and the alert icon. Only the HTML validator in CI caught it.
Proposal
Report a {{ }} interpolation whose parent element is <svg>, <math> or another element inside them, where text is not allowed, as a citry check and editor finding. The message should say that the text is escaped and point to the fix: insert trusted markup as HTML, or render the SVG elements in the template.
Open questions
Severity: SVG allows text inside elements such as <text>, <tspan>, <title> and <desc>, so the rule must skip those. Elsewhere inside SVG, text is never drawn; is that an error or a warning?
Should the rule also cover Vue's v-text and {{ }} inside <math>?
Activity