Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove support for <svg> elements and “svg” tagged template function in default template engine. #236

Open
theengineear opened this issue Dec 20, 2024 · 0 comments

Comments

@theengineear
Copy link
Collaborator

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…

  1. Continue to support <svg> interpolations and the svg tagged template function.
  2. Support it minimally in the future (e.g., perhaps static, with no interpolations).
  3. 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.

@theengineear 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant