Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295024

[DrupalHtmlEngine] HTML-reserved characters (>, <, &) in <script> and <style> tag are converted to HTML entities

$
0
0

Problem/Motivation

<script> tag
Javascript operators (>, &&, ...) in <script> tag are converted to html entities.

Steps to reproduce

Paste this test code in a <script> tag in ckeditor, you will get a syntax error: Uncaught SyntaxError: Unexpected token ';'. This is caused by the operators that have been converted to html entities: if(y &lt; x){

<script type="text/javascript">
let x = 10;
let y = 5;
if(y < x){
console.log('is smaller')
}
</script>
<style> tag
The site administrators are using the CKEditor 5 FULL HTML text format to provide custom stylings using tags with the source editing. But when the css is used with the '>' syntax, ex:
<style type="text/css">
.sections > h2 {
</style>

the > symbol (the child combinator selector: https://developer.mozilla.org/en-US/docs/Web/CSS/Child_combinator) gets replaced into html entities and shown as

<style type="text/css">
.sections &gt; h2 {
</style>

Viewing all articles
Browse latest Browse all 295024

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>