Hi,

I've noticed a serialization difference since updating to BaseX-12.1, and am wondering if this is intentional or not.

When serializing as HTML 5.0, the character escaping in <script> tags seems to be influenced by the presence of preceding <script> tags that are either empty or only contain collapsible whitespace:

 * when a <script> element follows a non-empty (or non-collapsible)
   <script> element, special characters like &, <, and > are unescaped
   in the output
     o input:

       <head>
          <script><![CDATA[& < > ]]></script>
          <script src="test">//</script>
          <script>&amp; &lt; &gt;</script>
       </head>
       ! serialize(., map {"method":"html", "version":"5.0"})

     o output:

       <head>
          <meta charset="UTF-8">
          <script>& < > </script>
          <script src="test">//</script>
          <script>& < ></script>
       </head>

 * when, however, a <script> element follows an empty (or collapsible)
   <script> element, special characters like &, <, and > are escaped in
   the output
     o input:

       <head>
          <script><![CDATA[& < > ]]></script>
          *<script src="test"></script>*
          <script>&amp; &lt; &gt;</script>
       </head>
       ! serialize(., map {"method":"html", "version":"5.0"})

     o output:

       <head>
          <meta charset="UTF-8">
          <script>& < > </script>
          <script src="test">//</script>
          <script>*&amp; &lt; &gt;*</script>
       </head>

I'm wondering if this is intentional or a bug?

Best,

Ron

Reply via email to