EPA-WG/custom-element

Text injection/DOM parts

Opened this issue · 0 comments

<custom-element>
    <xsl:value-of select="//slice/fruits/text()"></xsl:value-of>
    some text
    <local-storage key="cherries" slice="fruits"></local-storage>
</custom-element>

has the text which is injected conditionally. When the data is not presented, there is no text node added. Which lead to inability to distinct the some text and otional fruits during merge DOM update.

Both, the Text node and xsl:value-of, have to be subject for data-dce-id in merge-adopted XSLT.

implementation

On the assureUnique() level for Text and xsl:value-of node need to be wrapped into dce-text node with data-dce-id defined.

{} alias for XPath text

<custom-element>
   {slice/fruits}
   is alias to
   <xsl:value-of select="/datadom/slice/fruits/text()"></xsl:value-of>
</custom-element>

In {v} the string would be replaced by /datadom/${v}/text(). The regex search on each text node would split the node to several wrapped by dce-text