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
One of the goals of the default template engine is to remain simple. It must enable rendering complex html structures, but the spec for so-called “foreign elements” (e.g., svg and math) diverges quite a bit. For example, attributes are case-insensitive in html, but case-sensitive in svg and math.
The three choices we have are…
Continue to support <svg> interpolations and the svg tagged template function.
Support it minimally in the future (e.g., perhaps static, with no interpolations).
Remove support (e.g., require that developers inject such things via a document fragment).
Supporting (1) above is quite nuanced as the spec (and conventions) differ significantly. Rather than trying to make everything work — it may be a better choice to simply restrict this option and provide documentation around workarounds.
For example, one of the main uses for svg is static iconography. This can easily be done by setting template.setHTMLUnsafe('<svg>…</svg>') and then passing template.content (a document fragment) to the template engine as an interpolated value.
The text was updated successfully, but these errors were encountered:
theengineear
changed the title
Discussion: Remove support for <svg> elements and “svg” tagged template function in default template engine?
Remove support for <svg> elements and “svg” tagged template function in default template engine.
Dec 28, 2024
One of the goals of the default template engine is to remain simple. It must enable rendering complex html structures, but the spec for so-called “foreign elements” (e.g., svg and math) diverges quite a bit. For example, attributes are case-insensitive in html, but case-sensitive in svg and math.
The three choices we have are…
<svg>
interpolations and thesvg
tagged template function.Supporting (1) above is quite nuanced as the spec (and conventions) differ significantly. Rather than trying to make everything work — it may be a better choice to simply restrict this option and provide documentation around workarounds.
For example, one of the main uses for svg is static iconography. This can easily be done by setting
template.setHTMLUnsafe('<svg>…</svg>')
and then passingtemplate.content
(a document fragment) to the template engine as an interpolated value.The text was updated successfully, but these errors were encountered: