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

<svg><script></script></svg> is causing Uncaught TypeError: r.src is undefined when library is aggregated #488

Open
sascha-meissner opened this issue Dec 1, 2023 · 0 comments

Comments

@sascha-meissner
Copy link

I´m getting error Uncaught TypeError: r.src

when having

<svg><script></script></svg>

within my html and aggregate the klaro library with other js libraries (Drupal javascript aggregation)

The error can be supressed by checking for existence of src attribute in:
https://github.com/klaro-org/privacy-manager/blob/d2f8418ede6b7706090fd0d746a5bb0046772d45/src/utils/compat.js#L9

e.g script.src && script.src.includes(name)

This issue might be somehow related to #273
But i´m having this error in every browser i tested (Firefox, Chrome) not only in IE11

And yes, the problem is that klaro library is not in its own script tag but bundled with other js files in a single script tag, thats why it cannot determine which is the "currentScript", it still might be worth to check for the src attribute as it will also fail if theres a script tag with a body/ without src attribute occuring before the klaro script

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

No branches or pull requests

1 participant