script tags are interpreted as CDATA in typical html but in xhtml characters are interpreted using the standard syntax so for example, < and & are represented by < and &. You may think this is irrelevant in modern web because nobody uses xhtml but they do. Any time a script tag is nested inside an svg tag, it is interpreted as xhtml. See this example:
<script type="module">
const gt = 5;
const test = 5 > + 7;
console.log(+test); // > 5
</script>
<svg>
<script type="module">
const gt = 5;
const test = 5 > + 7;
console.log(+test); // > 0
</script>
</svg>
In the first script test is set to 5 & gt which is 5 & 5 resulting in 5. In the second script > is converted to > so test is set to 5 > +7 which is false. Then +test is coerced into 0.
scripttags are interpreted as CDATA in typical html but in xhtml characters are interpreted using the standard syntax so for example,<and&are represented by<and&. You may think this is irrelevant in modern web because nobody uses xhtml but they do. Any time ascripttag is nested inside ansvgtag, it is interpreted as xhtml. See this example:In the first script
testis set to5 & gtwhich is5 & 5resulting in5. In the second script>is converted to>sotestis set to5 > +7which isfalse. Then+testis coerced into0.