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

shadow-root not rendered. #474

Open
Osiris-Team opened this issue Apr 5, 2024 · 1 comment · May be fixed by #475
Open

shadow-root not rendered. #474

Osiris-Team opened this issue Apr 5, 2024 · 1 comment · May be fixed by #475

Comments

@Osiris-Team
Copy link

Osiris-Team commented Apr 5, 2024

Simple example to show this issue:

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>DOM to PDF Shadow Root Example</title>
</head>

<body>
  <div id="container"></div>

  <script src="https://unpkg.com/[email protected]/src/dom-to-image.js"></script>
  <script>
    document.addEventListener('DOMContentLoaded', function () {
      var container = document.getElementById('container');
      var root = container.attachShadow({ mode: 'open' });
      root.textContent = 'Hello World!';

      domtoimage.toPng(container)
        .then(function (dataUrl) {
          var img = new Image();
          img.src = dataUrl;
          document.body.appendChild(img);
        })
        .catch(function (error) {
          console.error('Oops, something went wrong!', error);
        });
    });
  </script>
</body>

</html>

The issue is that dom-to-image creates a blank image instead containing the text.

@forever0714yuan
Copy link

forever0714yuan commented Apr 5, 2024 via email

@Osiris-Team Osiris-Team linked a pull request Apr 8, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants