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

Morphdom Support for Template Elements #251

Open
nickarora opened this issue Apr 20, 2024 · 0 comments
Open

Morphdom Support for Template Elements #251

nickarora opened this issue Apr 20, 2024 · 0 comments

Comments

@nickarora
Copy link

I've reviewed past issues and was not able to find a clear answer.

For the given markup:

<template id="template-1">
  <p>One</p>
</template>

<template id="template-2">
  <p>Two</p>
</template>

And the following invocation of morphdom:

const template1 = document.querySelector("#template-1")

const template2 = document.querySelector("#template-2")

const morphed = morphdom(template1, template2)

the resulting morphed value is

<template id="template-2">
  <p>One</p>
</template>

The ID of the template was morphed but the children were not.

Is this an expected limitation? It is worth noting that when using the template element, the element's content is not rendered, only parsed into a document fragment. I am wondering if the fragment has a role to play in the observed behavior:

<template>
  #document-fragment
    <p>Some content</p>
</template>
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