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

Support async attribute in non-HTML5 script tags #611

Merged
merged 1 commit into from
Feb 7, 2024

Conversation

tynanbe
Copy link
Contributor

@tynanbe tynanbe commented Jan 17, 2024

When a theme doesn't declare support for HTML5 scripts, WordPress outputs the code like this:

<script type="text/javascript" src="https://.../wp-includes/assets/js/comment-reply.min.js" id="comment-reply-js" async="async" data-wp-strategy="async"></script>

The tag currently gets incorrectly rewritten to:

<script data-optimized="1" type="litespeed/javascript" data-src="https://.../wp-content/litespeed/js/generatedname.js?ver=hash" id="comment-reply-js"="async" data-wp-strategy="async"></script>

With this change, users shouldn't have to e.g.

add_action( 'after_setup_theme', function() {
   add_theme_support( 'html5', [ 'script' ] );
}, 10 );

@tynanbe tynanbe marked this pull request as ready for review February 7, 2024 14:38
@hi-hai hi-hai changed the base branch from dev to v6.2 February 7, 2024 18:42
@hi-hai hi-hai merged commit 4f293d0 into litespeedtech:v6.2 Feb 7, 2024
1 check failed
@tynanbe tynanbe deleted the non_html5_async branch February 14, 2024 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants