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-injector.js:970 Uncaught TypeError: Cannot read property 'replaceChild' of null #28

Open
sKopheK opened this issue Nov 20, 2019 · 0 comments

Comments

@sKopheK
Copy link

sKopheK commented Nov 20, 2019

Hi, when multiple instances of SVGInjector are processing various elements with the same URL, an error upon calling replaceChild() on a null object appears, but the element is inserted properly.

Updated examples/simple.html:

<svg class="icon icon--thumb inject-me" data-src="assets/svg/thumb-up.svg" title="I like it!" alt="thumb" onclick="console.log('clicked');"/>
<svg class="icon icon--thumb test-me" data-src="assets/svg/thumb-up.svg" title="I like it!" alt="thumb" onclick="console.log('clicked');"/>
<svg class="icon icon--thumb fetch-me" data-src="assets/svg/thumb-up.svg" title="I like it!" alt="thumb" onclick="console.log('clicked');"/>

<script src="../src/svg-injector.js"></script>
<script>
    new SVGInjector().inject(document.querySelectorAll('.inject-me'));
    new SVGInjector().inject(document.querySelectorAll('.test-me'));
    new SVGInjector().inject(document.querySelectorAll('.fetch-me'));
</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