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

outerHTML morph not working with a purely text-based update #56

Open
renardeinside opened this issue Jun 11, 2024 · 2 comments
Open

outerHTML morph not working with a purely text-based update #56

renardeinside opened this issue Jun 11, 2024 · 2 comments

Comments

@renardeinside
Copy link

I've hit quite a strange behavior of Idiomorph.morph, namely:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Test</title>
  <script src="https://unpkg.com/[email protected]"></script>
</head>
<body>
<div id="schorle-page">
  <div id="sle-000">
    <button id="me">Click me</button>
  </div>
</div>
<script>
  btn = document.getElementById('me');
  newPayload = `
    <div id="sle-000">
      <button id="me">${Math.random()}</button>
    </div>`;
  console.log(`Script loaded`);
  btn.addEventListener('click', function() {
    const node = document.getElementById('sle-000');
    console.log('Node to be morphed', node);
    console.log('New payload', newPayload);
    Idiomorph.morph(node, newPayload, {ignoreActiveValue: true, morphStyle: 'outerHTML'});
    console.log('Node after morph', node);
  });

</script>
</body>
</html>

I would expect the text of the button to be updated, but nothing happens. Am I missing something?

@renardeinside
Copy link
Author

@pbowyer
Copy link

pbowyer commented Oct 15, 2024

When I run your example on Stackblitz in Chrome it morphs as expected. Is it now working for you?

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