Make WordPress Core

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's profile n3wjack Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.8.3
Component: Widgets Keywords:
Focuses: Cc:


Steps to reproduce:

  1. Add an HTML widget to a footer block containing a script block with multiple lines of JS code.
  2. Save.
  3. Refresh the page (F5)


The JS code now contains <br/> statements, breaking the code.
When you save again, the JS will fail in the browser.


No extra HTML tags are added to an HTML widget.

Example HTML widget content:

<script src=''></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'

Example of resulting HTML code with extra HTML tags:

<p><script src=""></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 />

Change History (1)

#1 @costdev
3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to reported-upstream
  • Status changed from new to closed

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.

Note: See TracTickets for help on using tickets.