Skip to content
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

Import Maps: Only emit CDATA wrappers for inline scripts for JavaScript #58818

Merged
merged 2 commits into from Feb 8, 2024

Conversation

cbravobernal
Copy link
Contributor

What?

I'm backporting this fix for WordPress 6.4. So that sites with WP < 6.5 and Gutenberg, and old classic themes that does not support html5.
WordPress/wordpress-develop#5925

Testing Instructions

  • Use a WordPress version < 6.5. 6.4.3 is the highest (bug is already fixed on trunk)
  • Use a classic theme that does not support html5. IE: Twenty Twelve
  • Create a post, add an image, activate "expand on click"
  • It should not work in trunk, it should work in this PR.

@cbravobernal cbravobernal added [Type] Bug An existing feature does not function as intended Backport to Gutenberg Minor Release Pull request that needs to be backported to a Gutenberg minor release [Feature] Script Modules API Related to the Script Modules API that adds support for native ES modules and import maps labels Feb 8, 2024
@cbravobernal cbravobernal self-assigned this Feb 8, 2024
Copy link

github-actions bot commented Feb 8, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: c4rl0sbr4v0 <cbravobernal@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link

github-actions bot commented Feb 8, 2024

This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress.

If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged.

If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack.

Thank you! ❤️

View changed files
❔ lib/compat/wordpress-6.5/class-wp-script-modules.php
❔ lib/compat/wordpress-6.5/script-loader.php

@@ -107,3 +107,109 @@ static function ( $settings ) {
return $settings;
}
);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be in the 6.5 folder though? This fix is not on 6.4 right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true. I mislead with being compatible with 6.4 versions.

@cbravobernal cbravobernal enabled auto-merge (squash) February 8, 2024 11:20
@cbravobernal cbravobernal force-pushed the fix/import-map-loading-not-html5-templates branch 2 times, most recently from 9dc0bdd to 467c624 Compare February 8, 2024 15:24
@cbravobernal cbravobernal force-pushed the fix/import-map-loading-not-html5-templates branch from 467c624 to c4b48b6 Compare February 8, 2024 16:59
@cbravobernal cbravobernal merged commit bee57c4 into trunk Feb 8, 2024
56 checks passed
@cbravobernal cbravobernal deleted the fix/import-map-loading-not-html5-templates branch February 8, 2024 17:31
@github-actions github-actions bot added this to the Gutenberg 17.7 milestone Feb 8, 2024
cbravobernal added a commit that referenced this pull request Feb 8, 2024
…pt (#58818)

* Add fix from Core Trunk to Gutenberg

* Move to 6.5 compat folder

Co-authored-by: c4rl0sbr4v0 <cbravobernal@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
cbravobernal added a commit that referenced this pull request Feb 8, 2024
cbravobernal added a commit that referenced this pull request Feb 8, 2024
…pt (#58818)

* Add fix from Core Trunk to Gutenberg

* Move to 6.5 compat folder

Co-authored-by: c4rl0sbr4v0 <cbravobernal@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
cbravobernal added a commit that referenced this pull request Feb 8, 2024
cbravobernal added a commit that referenced this pull request Feb 8, 2024
…pt (#58818)

* Add fix from Core Trunk to Gutenberg

* Move to 6.5 compat folder

Co-authored-by: c4rl0sbr4v0 <cbravobernal@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
cbravobernal added a commit that referenced this pull request Feb 8, 2024
@cbravobernal cbravobernal removed the Backport to Gutenberg Minor Release Pull request that needs to be backported to a Gutenberg minor release label Feb 8, 2024
cbravobernal added a commit that referenced this pull request Feb 8, 2024
* Import Maps: Only emit CDATA wrappers for inline scripts for JavaScript (#58818)

* Add fix from Core Trunk to Gutenberg

* Move to 6.5 compat folder

Co-authored-by: c4rl0sbr4v0 <cbravobernal@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>

* Revert "Import Maps: Only emit CDATA wrappers for inline scripts for JavaScript (#58818)"

This reverts commit 2a16bdd.

* Import Maps: Only emit CDATA wrappers for inline scripts for JavaScript (#58818)

* Add fix from Core Trunk to Gutenberg

* Move to 6.5 compat folder

Co-authored-by: c4rl0sbr4v0 <cbravobernal@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>

* Revert "Import Maps: Only emit CDATA wrappers for inline scripts for JavaScript (#58818)"

This reverts commit 4b65571.

* Import Maps: Only emit CDATA wrappers for inline scripts for JavaScript (#58818)

* Add fix from Core Trunk to Gutenberg

* Move to 6.5 compat folder

Co-authored-by: c4rl0sbr4v0 <cbravobernal@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>

* Load scrip-loader file, was not in the cherry-pick

* Revert "Import Maps: Only emit CDATA wrappers for inline scripts for JavaScript (#58818)"

This reverts commit 2031222.

* Revert "Load scrip-loader file, was not in the cherry-pick"

This reverts commit 94237e0.

* Fix cdata crashing modules in not html5 compatible themes

---------

Co-authored-by: c4rl0sbr4v0 <cbravobernal@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Script Modules API Related to the Script Modules API that adds support for native ES modules and import maps [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants