-
Notifications
You must be signed in to change notification settings - Fork 21
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
String attributes not being applied to script element #6
Comments
Do you mean this case? react-script-hook/src/__tests__/use-script.test.tsx Lines 32 to 55 in 1cdca7a
|
I do. I did run your tests locally and they seem to pass, however when implementing this hook elsewhere the
|
Yes, then let's change that. Setting the attributes via the API is also a bit cleaner. Do you want to create a PR? |
Yeah sure I'll open one shortly. |
@hupe1980 I have a branch with these updates. Can you double check the access rights for the repo? I can't push currently. |
You have to fork my repo, push your change and then create a pr |
Merged #7 into master. |
Hi. Unfortunately PR #7 breaks the onload callback. It seems setAttribute does not handle attributes like onload properly and the event handler doesn't fire. I'll PR my hotfix to consider that sets only non-standard attributes with setAttribute. |
I'm noticing that string attributes (e.g. 'data-testid') are not added to the script element properly. In the example below I'm loading the google api script, but when I inspect the script element upon load the
data-testid
property is missing.I'd like purpose updating the code to use
setAttribute(key, attributes[key]
rather thanscriptEl[key] = attributes[key]
. I'm happy to open a PR for this if you're onboard with the change.The text was updated successfully, but these errors were encountered: