Opened 3 years ago
Closed 3 years ago
#54828 closed defect (bug) (reported-upstream)
BR tags are added to HTML widget code
Reported by: | n3wjack | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 5.8.3 |
Component: | Widgets | Keywords: | |
Focuses: | Cc: |
Description
Steps to reproduce:
- Add an HTML widget to a footer block containing a script block with multiple lines of JS code.
- Save.
- Refresh the page (F5)
Result:
The JS code now contains <br/> statements, breaking the code.
When you save again, the JS will fail in the browser.
Expected:
No extra HTML tags are added to an HTML widget.
Example HTML widget content:
<script src='https://storage.ko-fi.com/cdn/scripts/overlay-widget.js'></script> <script> kofiWidgetOverlay.draw('n3wjack', { 'type': 'floating-chat', 'floating-chat.donateButton.text': 'Support Me', 'floating-chat.donateButton.background-color': '#323842', 'floating-chat.donateButton.text-color': '#fff' }); </script>
Example of resulting HTML code with extra HTML tags:
<p><script src="https://storage.ko-fi.com/cdn/scripts/overlay-widget.js"></script><br> <script><br /> if (document.body.classList.contains('post-template-default')) {<br /> kofiWidgetOverlay.draw('n3wjack', {<br /> 'type': 'floating-chat',<br /> 'floating-chat.donateButton.text': '',<br /> 'floating-chat.donateButton.background-color': '#323842',<br /> 'floating-chat.donateButton.text-color': '#fff'<br /> });<br /> }<br /> </script></p>
Change History (1)
Note: See
TracTickets for help on using
tickets.
Hi @n3wjack, thanks for opening this ticket.
This has been reported upstream at the Gutenberg repo. See GB 33936. Let's continue the discussion there.