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 the wp_add_inline_script function to provide a means for specifying an inline script as being standalone #15

Closed
1 task done
10upsimon opened this issue Feb 9, 2023 · 1 comment · Fixed by #46
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 part of enhancing the Scripts API with a loading strategy, there is a requirement to correctly handle inline scripts attached to main scripts so that their execution order is maintained. Inline scripts may, however, want to remain totally strategy agnostic and function in a standalone mode, having no inherent need to obey any parent/main script loading strategies. In order to provide this functionality, inline scripts should be able to specify/opt in to a standalone mode.

The existing wp_add_inline_script method, currently residing in WordPress core source at this location, should therefore be updated to cater for this new requirement. It should achieve this by way of introducing a new $standalone parameter to the function. This boolean parameter will be used to determine whether a user has opted for said inline script to be $standalone or not.

Acceptance Criteria

  • Enhancement to the existing wp_add_inline_script method, allowing the specification of a boolean value against a new $standalone parameter. This method currently resides in WordPress core source at this location.
    • Addition of a new $standalone parameter to said above function.
    • The $standalone parameter is to be of type boolean
    • The $standalone parameter is to have a default value of false

Unit Tests

  • Unit tests for the various processes surrounding wp_add_inline_script method currently reside in WordPress core source, starting at this location.
  • Applicable tests should be added that assert that the values of $standalone are of type boolean.
  • Applicable tests should be added that assert that the default value of $standalone is false.

Designs

No response

Describe alternatives you've considered

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@eclarke1
Copy link

@10upsimon I notice this one is in To Do, but there's no comments relating to AC approval? Is it correct that it is ready to be worked on?
cc @joemcgill

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.

4 participants