Open nolanlawson opened 17 hours ago
If HTML comments are adjacent to an empty text node and a non-empty text node, and if lwc:preserve-comments is false, then non-static-optimized template HTML will render ZWJ (Zero-Width-Joiner) characters incorrectly.
lwc:preserve-comments
Repro:
<template> <span lwc:spread={fake}> {dynamic}<!-- comment -->text<!-- comment -->{dynamic} </span> </template>
Renders:
<x-comments-text> <template shadowrootmode="open"> <span> [ZWJ]text[ZWJ] </span> </template> </x-comments-text>
(GitHub doesn't render the ZWJ in a way you can easily see, so I marked them above.)
Static-optimized code does not have the same issue. I'm using lwc:spread={fake} above to manually disable the static content optimization.
lwc:spread={fake}
ZWJ characters are only supposed to be rendered for a single empty text node. Since the HTML above has non-empty text, there should be no ZWJ.
Repro: 319a54634
This issue has been linked to a new work item: W-17110937
If HTML comments are adjacent to an empty text node and a non-empty text node, and if
lwc:preserve-comments
is false, then non-static-optimized template HTML will render ZWJ (Zero-Width-Joiner) characters incorrectly.Repro:
Renders:
(GitHub doesn't render the ZWJ in a way you can easily see, so I marked them above.)
Static-optimized code does not have the same issue. I'm using
lwc:spread={fake}
above to manually disable the static content optimization.ZWJ characters are only supposed to be rendered for a single empty text node. Since the HTML above has non-empty text, there should be no ZWJ.
Repro: 319a54634