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

feat: add support for crossorigin script attribute #435

Merged
merged 1 commit into from
Nov 13, 2023

Conversation

gregjopa
Copy link
Contributor

@gregjopa gregjopa commented Nov 13, 2023

This PR adds support for the crossorigin script attribute.

For example, the following loadScript() call will create the following script tag in the DOM:

loadScript({ clientId: "test", crossorigin: "anonymous" })
<script src="https://www.paypal.com/sdk/js?client-id=test" crossorigin="anonymous"></script>

Resolves #434

@gregjopa gregjopa requested a review from a team as a code owner November 13, 2023 16:59
@@ -64,7 +64,7 @@ export function insertScriptElement({

export function processOptions(options: PayPalScriptOptions): {
url: string;
dataAttributes: StringMap;
attributes: StringMap;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I renamed dataAttributes to attributes to better reflect that both data attributes and script attributes are included.

Copy link
Contributor

@nbierdeman nbierdeman left a comment

Choose a reason for hiding this comment

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

💯 🚢

@gregjopa gregjopa merged commit d504cc7 into main Nov 13, 2023
2 checks passed
@gregjopa gregjopa deleted the crossorigin-attribute branch November 13, 2023 17:35
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.

How to inject crossorigin="anonymous" in script tag when using loadScript
3 participants