Opened 2 years ago
Closed 2 years ago
#61540 closed defect (bug) (duplicate)
WordPress html block breaks scripts.
| Reported by: | programmin | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Formatting | Version: | 6.5.5 |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
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.
2 years ago
#3
@
2 years 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
@
2 years ago
- Component General → Formatting
- Milestone Awaiting Review
- Resolution → duplicate
- Status new → 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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
It looks like it may be detecting the
<as an opening tag.