-
Notifications
You must be signed in to change notification settings - Fork 397
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
fix(ssr): correctly render foreign namespace element closing tags #4992
Changes from all commits
7287465
6ea8218
66b4a37
ff5fe94
35d5797
8d6d2e4
5c6bfe6
0cab84d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<x-elements class="lwc-4q9u0sqsfc0-host" data-lwc-host-scope-token="lwc-4q9u0sqsfc0-host"> | ||
<template shadowrootmode="open"> | ||
<style class="lwc-4q9u0sqsfc0" type="text/css"> | ||
:host {background: blue;} | ||
</style> | ||
<a class="lwc-4q9u0sqsfc0" href="https://www.salesforce.com/"> | ||
</a> | ||
<label class="lwc-4q9u0sqsfc0" for="textInput"> | ||
Some input | ||
</label> | ||
<input class="lwc-4q9u0sqsfc0" id="textInput" type="text"> | ||
<svg class="lwc-4q9u0sqsfc0"> | ||
<pattern class="lwc-4q9u0sqsfc0"> | ||
<image class="lwc-4q9u0sqsfc0" xlink:href="https://www.salesforce.com/"/> | ||
</pattern> | ||
<image class="lwc-4q9u0sqsfc0" xlink:title="title"/> | ||
</svg> | ||
<math class="lwc-4q9u0sqsfc0"> | ||
<mrow class="lwc-4q9u0sqsfc0"> | ||
<mi class="lwc-4q9u0sqsfc0"> | ||
a | ||
</mi> | ||
<mo class="lwc-4q9u0sqsfc0"> | ||
+ | ||
</mo> | ||
<mi class="lwc-4q9u0sqsfc0"> | ||
b | ||
</mi> | ||
</mrow> | ||
</math> | ||
<svg class="lwc-4q9u0sqsfc0"> | ||
<pattern class="lwc-4q9u0sqsfc0"> | ||
<image xlink:href="https://www.salesforce.com/"> | ||
</image> | ||
</pattern> | ||
<image class="lwc-4q9u0sqsfc0" xlink:title="title"/> | ||
</svg> | ||
</template> | ||
</x-elements> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const tagName = 'x-elements'; | ||
export { default } from 'x/elements'; | ||
export * from 'x/elements'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<template> | ||
<!-- Empty non-void HTML namespace element --> | ||
<a href="https://www.salesforce.com/"></a> | ||
<!-- Non-empty non-void HTML namespace element --> | ||
<label for="textInput">Some input</label> | ||
<!-- Void HTML namespace element --> | ||
<input id="textInput" type="text"> | ||
<!-- Foreign namespace elements --> | ||
<svg> | ||
<!-- Non-empty foreign element --> | ||
<pattern> | ||
<image xlink:href="https://www.salesforce.com/"></image> | ||
</pattern> | ||
<!-- Empty foreign element --> | ||
<image xlink:title="title"></image> | ||
</svg> | ||
<math> | ||
<!-- TODO [#5015]: Add void example --> | ||
<mrow> | ||
<mi>a</mi> | ||
<mo>+</mo> | ||
<mi>b</mi> | ||
</mrow> | ||
</math> | ||
<!-- Rendered with inner-html --> | ||
<svg> | ||
<pattern lwc:inner-html={foreignNamespaceInnerHtml}></pattern> | ||
<image xlink:title="title"></image> | ||
</svg> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It'd be great to add a MathML block here for completeness. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. including Is that OK or would you rather modify template-compiler -> validateElement to recognize MathML elements, or...? I suppose it could be argued that the same warning / tag-check should be there for @lwc/ssr-compiler too, or not needed? I'm not sure as tags used in the correct namespace shouldn't really generate a warning, so should we be reproducing this behavior in v2 regardless? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, opened an issue for this: #5010 MathML should be supported. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok thanks, seems wrong. I updated the warning suppression in the fixture to reference the issue you opened. |
||
</template> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { LightningElement, api } from 'lwc'; | ||
|
||
export default class extends LightningElement { | ||
@api foreignNamespaceInnerHtml = '<image xlink:href="https://www.salesforce.com/"></image>'; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
:host { | ||
background: blue; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is bizarre... we should fix this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UNKNOWN_HTML_TAG_IN_TEMPLATE
) for MathML elements #5010There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, updated the comment with a TODO on that issue.