Opened 2 years ago
Closed 2 years ago
#59778 closed defect (bug) (maybelater)
remove not needed function call in wp_post_preview_js
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | |
| Component: | Script Loader | Keywords: | has-patch close |
| Focuses: | javascript | Cc: |
Description (last modified by )
In this function, we created some JS with "<script>" tags and removed them with a call to wp_remove_surrounding_empty_script_tags()
So this patch removes the tags and function call
see ticket #59775 for tests for this function/change
Change History (6)
This ticket was mentioned in PR #5600 on WordPress/wordpress-develop by @pbearne.
2 years ago
#2
- Keywords has-patch added
#4
@
2 years ago
I agree the change made by @westonruter was an improvement of what was there before, and having the <script> tag makes clear that you are looking at a block JS code.
But in all the cases, you could not include the <script> tag and get the same output with one less call.
#5
@
2 years ago
- Keywords close added
The <script> tag is needed for the sake of IDEs to do static analysis at development time. Since this JavaScript code is not run through any linters at build time, having every bit of development support at code time is important. The removal of wp_remove_surrounding_empty_script_tags() should only happen once the <script> wrappers aren't needed anymore, which would be done as part of #59444. Once the minimum version of PHP is bumped to 7.3, then HEREDOC strings can be used instead of the <script> wrappers and wp_remove_surrounding_empty_script_tags() can be removed.
Thanks @pbearne for the ticket and PR!
@westonruter added the
wp_remove_surrounding_empty_script_tagsfunction in [56748] / #58664. I'd appreciate getting his thoughts on this matter.