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

HTMLTemplateElement toString does not include contents #215

Open
saviski opened this issue Jul 26, 2023 · 1 comment
Open

HTMLTemplateElement toString does not include contents #215

saviski opened this issue Jul 26, 2023 · 1 comment

Comments

@saviski
Copy link

saviski commented Jul 26, 2023

get content() {

I see that this related issue is marked as closed #21

But later modifications removed this functionality

I am using this hack locally to get the functionality I need

  const originaltoString = Object.getOwnPropertyDescriptor(Element.prototype, 'toString')!
  Object.defineProperties(HTMLTemplateElement.prototype, {
    toString: {
      value() {
        return (
          originaltoString.value
            .call(this)
            .replace(/<\/template>$/, this.content.childNodes.join('')) + '</template>'
        )
      },
    },
  })
@saviski saviski changed the title HTMLTemplateElement toString does not include it's contents HTMLTemplateElement toString does not include contents Jul 27, 2023
@WebReflection
Copy link
Owner

the test works though ... I am not sure when/where/how you are having issues ... can you share a minimal broken example code instead of your fix? 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