Skip to content

Conversation

@nlemoine
Copy link
Contributor

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes/features)
  • Docs have been added/updated (for bug fixes/features)

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

Bug fix

What is the current behavior? (You can also link to an open issue here)

When using prependInlineScript() together with withAttributes(), the attributes are not applied to the script tag. This happens because AttributesOutputFilter only checks the first <script> tag, which is the inline script without a src attribute.

What is the new behavior (if this is a feature change)?

Attributes are now correctly applied to the script tag with src, even when inline scripts are prepended before it.

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

No

Other information

The fix changes the if statement to a while loop in AttributesOutputFilter::__invoke() to iterate through all <script> tags until finding one with a src attribute.

@nlemoine
Copy link
Contributor Author

@widoz I would appreciate if you can have a look at this 🙏

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.

1 participant