preventing tranforming empty element with begin- and endtag to self-closing-tag

Friday, 23 May 2025 · 2 messages
RS
Rob Stapper23 May 2025 13:11 #

Hi Christian,

Basex seems to transform 'begin-/endtagged' element with empty content to a single self-closing-tagged element:

<div></div>

is transformed to:

</div>

This gives problems in my client application. Both in Chrome, Edge and Firefox transforms Javascript's "insertAdjacentHTML":

<div>
  <div/>
  <div>tekst</div>
  <div>tekst</div>
</div>

to:

<div>
  <div>
    <div>tekst</div>
    <div>tekst</div>
  </div>
</div>

This is not what is intended.

I guess for void-elements this transformation is ok but result in problems like this in case of container-elements.

Is it possible in Basex to suppress this transformation?

mvgr.

Rob Stapper

CG
Christian Grün23 May 2025 13:29 #
Quoted text · Rob Stapper · 2 lines
> > Hi Rob

Is it possible in Basex to suppress this transformation?

Quoted text · Rob Stapper · 1 line
>

You will need to serialize your data as HTML [1].

Hope this helps, Christian

[1] https://docs.basex.org/main/Serialization


⚡Generated with XQuery