-
Notifications
You must be signed in to change notification settings - Fork 398
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ssr): correctly render foreign namespace element closing tags (#4992
) * fix: correctly render foreign element closing tags * fix: properly handle scoped class for void and foreign elements * fix: address review comments * fix: remove math example for now * fix: ignore UNKNOWN_HTML_TAG_IN_TEMPLATE warning to allow for MathML test * fix: update tag warning suppression to reference issue * fix: simpler MathML example
- Loading branch information
1 parent
b8362b5
commit ee2edae
Showing
9 changed files
with
90 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
39 changes: 39 additions & 0 deletions
39
packages/@lwc/engine-server/src/__tests__/fixtures/render-correct-tags/expected.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
3 changes: 3 additions & 0 deletions
3
packages/@lwc/engine-server/src/__tests__/fixtures/render-correct-tags/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; |
30 changes: 30 additions & 0 deletions
30
...engine-server/src/__tests__/fixtures/render-correct-tags/modules/x/elements/elements.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
</template> |
5 changes: 5 additions & 0 deletions
5
...c/engine-server/src/__tests__/fixtures/render-correct-tags/modules/x/elements/elements.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>'; | ||
} |
3 changes: 3 additions & 0 deletions
3
...-server/src/__tests__/fixtures/render-correct-tags/modules/x/elements/elements.scoped.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
:host { | ||
background: blue; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters