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

Error: Required property is missing! [node.parentNode] #20

Open
denisov-k opened this issue Jan 11, 2023 · 1 comment
Open

Error: Required property is missing! [node.parentNode] #20

denisov-k opened this issue Jan 11, 2023 · 1 comment

Comments

@denisov-k
Copy link

Hello everyone!

I have next composition:

   <img v-svg-inline src="@/assets/widget/expand.svg" v-if="!expanded" />
   <img v-svg-inline src="@/assets/widget/collapse.svg" v-else />

After toggle v-if value I have next error in console.
err
Who can tell me what is the problem?

@oliverfindl
Copy link
Owner

Hello,

it looks like, Vue somehow removed parent element of your <img> tag, therefore this plugins fails to replace <img> tag with <svg> tag.

/* throw error if node argument is missing parentNode property */
if(!node.parentNode) throw new Error(`[${PACKAGE_NAME}] Required property is missing! [node.parentNode]`);
/* replace node with new node */
node.parentNode.replaceChild(newNode, node);

Please try to wrap your <img> tags with <div> tags, and move your conditions there. If this won't resolve your issue, please provide minimal reproduction repository, so I can investigate further.

Thanks.

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

2 participants