Bug: HTML block in the block template editor adds nonsensical HTML tags
-
Hello, I found a bug in the block template editor (it doesn’t seem to happen in the block page editor, just the template editor).
When I add the HTML block and add some code in it, initially it works well, but later WordPress adds some additional tags (that don’t make sense in the context) and the entire code stops working. Here’s an example of the original code:
<script> document.querySelectorAll('h2').forEach(e => { if(e.nextElementSibling.tagName != "UL") e.style.display = "none"; } }); </script> <style> ul, ol { padding-left: 50px !important; } </style>
and here’s what the block template editor turned it into:
<p><script><br /> document.querySelectorAll('h2').forEach(e => {<br /> if(e.nextElementSibling.tagName != "UL") {<br /> e.style.display = "none";<br /> }<br /> });<br /> </script></p> <style> ul, ol {<br /> padding-left: 50px !important;<br /> }<br /> </style>
It happened more than once already. ?? I need to keep the code written somewhere separately, so that I can replace the messed up one every time it happens.
It takes a while for it to happen, the code works at first, only eventually (after editing some other part of the template) the code gets messed up. And it doesn’t seem to happen to HTML blocks in the page editor, only when I’m editing a template.
- The topic ‘Bug: HTML block in the block template editor adds nonsensical HTML tags’ is closed to new replies.