mirrored from git://develop.git.wordpress.org/
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Eliminate manual construction of script tags in WP_Scripts and pass other scripts through wp_print_inline_script_tag() #4773
Closed
Closed
Changes from 10 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
0d3ae2d
Use script tag helper functions instead of manual construction
westonruter 86d74f0
WIP: Updating tests
westonruter 61c877c
Merge branch 'trunk' of https://github.com/WordPress/wordpress-develo…
westonruter 9ad9e6b
Fix Squiz.Strings.DoubleQuoteUsage.NotRequired
westonruter b52c335
Fix Tests_Dependencies_Scripts
westonruter 8355a8c
Remove extra hyphen in id for translations script
westonruter b9ebf8b
Use wp_print_inline_script_tag() in the_block_template_skip_link()
westonruter d05efbe
Use wp_print_inline_script_tag() for various scripts in admin screens
westonruter 3ac9a6e
Use wp_print_inline_script_tag() for admin scripts
westonruter adfef39
Fix inline script for list table
westonruter 6ba21ef
Merge branch 'trunk' of https://github.com/WordPress/wordpress-develo…
westonruter c19f75d
Extend script tag printing functions to accept closure
westonruter 50aafac
Use wp_print_inline_script_tag in more places
westonruter 0e27a38
Utilize language injections to annotate JS strings
westonruter 3b9b278
Remove incorrect static closures
westonruter 96b1e7a
Update test_remove_frameless_preview_messenger_channel
westonruter 96788c1
Merge branch 'trunk' of https://github.com/WordPress/wordpress-develo…
westonruter def2778
Revert wp-admin changes
westonruter 8bcd7a2
Revert changes to wp-admin, closure on wp_print_script_inline_tag, an…
westonruter 1194afe
Use wp_print_inline_script_tag() on login screen
westonruter 205b8de
Enqueue script-link script instead of printing
westonruter fd9028d
Merge branch 'trunk' of https://github.com/WordPress/wordpress-develo…
westonruter 2db59e5
Suggest missing ext-dom in composer.json
westonruter 3ba5135
Use DOM to normalize scripts in document fragment
westonruter ecc29a9
Escape wrapped CDATA sections
westonruter 832c315
Merge branch 'trunk' into trac-58664
westonruter 3840c54
Remove language injection comments for now
westonruter 97ad256
Revert Gutenberg upstream change
westonruter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really happy with the boilerplate
ob_start()
followed by an inline script followed by:I think ideally there would be a helper to do this automatically. Consider, for example, if
wp_print_inline_script_tag()
actually allowed a closure to be provided for the$javascript
parameter in addition to a string. It could handle the output buffering automatically, for instance:When a closure is passed, it could automatically start and end output buffering, strip the
script
start and end tags, and trim whitespace. If the output buffer lacks a<script>
it could issue a_doing_it_wrong()
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only purpose for having the
script
tags in the PHP code is to enable IDEs to do syntax-highlighting, syntax checking, autocompletion, etc. This is valuable so I think we should facilitate it somehow.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This modification to
wp_get_inline_script_tag()
has since been reverted in this PR.