[lit-html] Add MathML support with the mathml template tag#4637
[lit-html] Add MathML support with the mathml template tag#4637justinfagnani merged 16 commits intomainfrom
Conversation
🦋 Changeset detectedLatest commit: 2b78f7e The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📊 Tachometer Benchmark ResultsSummarynop-update
render
update
update-reflect
Resultsthis-change
render
update
update-reflect
this-change, tip-of-tree, previous-release
render
update
nop-update
this-change, tip-of-tree, previous-release
render
update
this-change, tip-of-tree, previous-release
render
update
update-reflect
|
|
The size of lit-html.js and lit-core.min.js are as expected. |
augustjk
left a comment
There was a problem hiding this comment.
Non-blocking, but maybe some cursory SSR tests would be nice?
e.g.
Also, should there be an unsafeMath() directive, like unsafeSVG()?
Co-authored-by: Augustine Kim <augustinekim@google.com>
|
@augustjk Thanks! I added |
|
There's a small question of the name of the template tag. I chose
|
augustjk
left a comment
There was a problem hiding this comment.
Thanks!
Regarding the tag name, I have a preference for mathml as the full name of the markup language, but not strong enough to block. Maybe an online poll on discord or twitter?
If we do change, I suppose the unsafe directive name should change to unsafeMathML too.
Let's ask Discord before merging. It's not unchangeable at least. Just a couple of byte cost to export two names. |
|
Math being the root element name for the MathML namespace makes me lean towards math as the tagged template name too fwiw. |
That's a good point. |
|
Discord seems to be leaning heavily towards |
augustjk
left a comment
There was a problem hiding this comment.
Change from math to mathml LGTM
|
@justinfagnani Do we also need a static version of |
done! |
Fixes #4636
This adds a
mathmltemplate tag to enable writing MathML fragment templates, just like how we have thesvgtemplate tag for SVG fragment templates.The change adds another TemplateResult type for MATHML, and just creates a
<math>wrapper element for fragment templates like we do for SVG.I had to update the
@open-wc/testingdependency of the starter kits because 3.x had hard-coded the template result types. 4.x works with the new type. So there is the possibility that that this will break type-checking of other libraries that hard-code the types. Hopefully they can upgrade quickly if they need to. Our policy is to not consider type-only breaks as semver major, so this change is semver minor.cc @lukewarlow @bkardell 😄