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

Update WP_Script logic surrounding wp_add_inline_script function to handle standalone vs non standalone logic. #19

Closed
1 task done
10upsimon opened this issue Feb 9, 2023 · 1 comment · Fixed by #49
Assignees
Labels
15 Estimate of 15 points Script Loading Strategy Issues relating to the Script Loading Strategy (WPP) type:enhancement New feature or request.
Milestone

Comments

@10upsimon
Copy link

Description

As per issue 15 where a means to opt in a script as standalone has been introduced, logic within the WP_Scripts class that handle the printing of inline scripts should be amended so that any inline script that specifies a $standalone = true approach bypasses all further logic that determines its parents load handler, type="module" etc.

Acceptance Criteria

  • Enhance the existing WP_Scripts class in areas that handle inline script preparation and printing to ensure that if an inline script is opted in as standalone (see issue 15), it bypasses all further loading strategy checks, is specified as standalone in its data/properties, and is printed as blocking in whichever position it was specified for: before or after.

Unit Tests

  • Unit tests for the various processes surrounding wp_add_inline_script method currently reside in WordPress core source, starting at this location.
  • Add/edit the necessary unit tests to ensure that inline scripts that are marked as standalone are void of further loading strategy logic checks and printed in the location specified. Tests should include inline scripts associated with deferred and non deferred parent/main scripts in order to validate the business logic.

Designs

No response

Describe alternatives you've considered

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@10upsimon 10upsimon converted this from a draft issue Feb 9, 2023
@10upsimon 10upsimon added type:enhancement New feature or request. Script Loading Strategy Issues relating to the Script Loading Strategy (WPP) 15 Estimate of 15 points labels Feb 9, 2023
@10upsimon 10upsimon added this to the Milestone 3 milestone Feb 9, 2023
@joemcgill
Copy link
Collaborator

This one seems good to me 👍 and maybe should be implemented first, before tackling the more complex logic for dependency/loading strategy management.

@joemcgill joemcgill assigned 10upsimon and unassigned joemcgill Feb 13, 2023
@kt-12 kt-12 moved this from To Do to In Progress in Enhancing the Scripts API with a loading strategy Mar 10, 2023
@kt-12 kt-12 moved this from In Progress to Code Review in Enhancing the Scripts API with a loading strategy Mar 10, 2023
@kt-12 kt-12 self-assigned this Mar 10, 2023
@kt-12 kt-12 moved this from Code Review to In Progress in Enhancing the Scripts API with a loading strategy Mar 10, 2023
@kt-12 kt-12 linked a pull request Mar 16, 2023 that will close this issue
@kt-12 kt-12 moved this from In Progress to Code Review in Enhancing the Scripts API with a loading strategy Mar 16, 2023
@10upsimon 10upsimon moved this from Code Review to Approval in Enhancing the Scripts API with a loading strategy Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
15 Estimate of 15 points Script Loading Strategy Issues relating to the Script Loading Strategy (WPP) type:enhancement New feature or request.
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

3 participants