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

NodeJS JSDOM support - ability to render on the backend #1424

Open
1 task
Darker opened this issue Feb 7, 2024 · 0 comments
Open
1 task

NodeJS JSDOM support - ability to render on the backend #1424

Darker opened this issue Feb 7, 2024 · 0 comments

Comments

@Darker
Copy link

Darker commented Feb 7, 2024

Would you like to work on this feature?

  • Check this if you would like to implement a PR, we are more than happy to help you go through the process.

What problem are you trying to solve?

I wanted to use this library to render a chart in an Express endpoint, or to a file.

Describe the solution you'd like

When I write code that manipulates DOM, I either have a optional argument for document or take document from element.ownerDocument if I am already taking an element as an argument. Similar solution would work here. This would require some changes to eliminate any global window and document references, but would help for two cases:

  1. Running this on the backend
  2. Trying to render chart in an iframe from the top level frame

Describe alternatives you've considered

I will try to mock window and document, but I don't think it is going to work.

Documentation, Adoption, Migration Strategy

Users should not notice a difference. The changes would only take an effect when the element is passed to chart constructor. In that case, that elements parent window and document would be used, instead of the globals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant