Opened 5 weeks ago
Closed 4 weeks ago
#61540 closed defect (bug) (duplicate)
WordPress html block breaks scripts.
Reported by: | programmin | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 6.5.5 |
Component: | Formatting | Keywords: | |
Focuses: | Cc: |
Description
I put in a custom html block and it breaks the script I enter, by turning && into &&
To test this, just enter this in HTML block on a new page:
<script> jQuery(function($){ if(vA!=win && vB!=win && vC==win && vD!=win) console.log('else'); if(vA<500 && vB<500 ) console.log('some other case'); }); </script>
For whatever reason, WP chooses to turn my script to & entity on some lines:
jQuery(function($){ if(vA!=win && vB!=win && vC==win && vD!=win) console.log('else'); if(vA<500 && vB<500 ) console.log('some other case'); });
Change History (4)
This ticket was mentioned in Slack in #core-test by tatasha2004. View the logs.
4 weeks ago
#3
@
4 weeks ago
@programmin you can try this
<script> jQuery(function($){ if(vA!=win && vB!=win && vC==win && vD!=win) console.log('else'); if(`vA<500 && vB<500`) console.log('some other case'); }); </script>
#4
@
4 weeks ago
- Component changed from General to Formatting
- Milestone Awaiting Review deleted
- Resolution set to duplicate
- Status changed from new to closed
This was reported as early as #43785, so I'll close as a duplicate.
Also, if you can enqueue the script instead of adding it inside a block, that should be better (especially because the example relies on jQuery).
Note: See
TracTickets for help on using
tickets.
It looks like it may be detecting the
<
as an opening tag.