diff options
author | Weston Ruter <westonruter@git.wordpress.org> | 2023-09-25 21:03:19 +0000 |
---|---|---|
committer | Weston Ruter <westonruter@git.wordpress.org> | 2023-09-25 21:03:19 +0000 |
commit | 4df5cd15a5c54c0c29e31b4cc68cd5483366b53e (patch) | |
tree | be8386d4d212f1e6870f4438d05ed57623a10d66 /composer.json | |
parent | 5c8b4c1b00d681abf3751ba0a8b009d5705acb02 (diff) | |
download | wordpress-4df5cd15a5c54c0c29e31b4cc68cd5483366b53e.tar.gz wordpress-4df5cd15a5c54c0c29e31b4cc68cd5483366b53e.zip |
Script Loader: Use `wp_get_script_tag()` and `wp_get_inline_script_tag()`/`wp_print_inline_script_tag()` helper functions to output scripts on the frontend and login screen.
Using script tag helper functions allows plugins to employ the `wp_script_attributes` and `wp_inline_script_attributes` filters to inject the `nonce` attribute to apply Content Security Policy (e.g. Strict CSP). Use of helper functions also simplifies logic in `WP_Scripts`.
* Update `wp_get_inline_script_tag()` to wrap inline script in CDATA blocks for XHTML-compatibility when not using HTML5.
* Ensure the `type` attribute is printed first in `wp_get_inline_script_tag()` for back-compat.
* Wrap existing `<script>` tags in output buffering to retain IDE supports.
* In `wp_get_inline_script_tag()`, append the newline to `$javascript` before it is passed into the `wp_inline_script_attributes` filter so that the CSP hash can be computed properly.
* In `the_block_template_skip_link()`, opt to enqueue the inline script rather than print it.
* Add `ext-php` to `composer.json` under `suggest` as previously it was an undeclared dependency for running PHPUnit tests.
* Update tests to rely on `DOMDocument` to compare script markup, normalizing unsemantic differences.
Props westonruter, spacedmonkey, flixos90, 10upsimon, dmsnell, mukesh27, joemcgill, swissspidy, azaozz.
Fixes #58664.
See #39941.
git-svn-id: https://develop.svn.wordpress.org/trunk@56687 602fd350-edb4-49c9-b593-d223f7449a82
Diffstat (limited to 'composer.json')
-rw-r--r-- | composer.json | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/composer.json b/composer.json index 46cc81b28a..10873fcee5 100644 --- a/composer.json +++ b/composer.json @@ -12,6 +12,9 @@ "require": { "php": ">=7.0" }, + "suggest": { + "ext-dom": "*" + }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "squizlabs/php_codesniffer": "3.6.0", |