Skip to content

fix exception on "template" elements #64

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

vaab
Copy link

@vaab vaab commented Mar 5, 2025

This patch is over 2.4.0 (I tried 4.0.0-alpha-8 with too many broken things).

It fixes:

        element.content.childNodes.forEach(function (childNode) {
                        ^

TypeError: Cannot read properties of undefined (reading 'childNodes')
    at getElementContent (/home/vaab/dev/js/monujo/node_modules/vue3-gettext/dist/bin/gettext_extract.js:93:25)
    at /home/vaab/dev/js/monujo/node_modules/vue3-gettext/dist/bin/gettext_extract.js:112:26
    at HtmlParser.parseNode (/home/vaab/dev/js/monujo/node_modules/gettext-extractor/dist/html/parser.js:19:13)

When encountering this file test.vue with this content:

<template>
  <svg>
    <template v-for="x in [1, 2]">
    </template>
  </svg>
</template>

I'm aware that this is a quick workaround rather than a wise thoughtful patch.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant