Would you like to work on this feature?
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:
- Running this on the backend
- 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.
Would you like to work on this feature?
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
documentor take document fromelement.ownerDocumentif I am already taking an element as an argument. Similar solution would work here. This would require some changes to eliminate any globalwindowanddocumentreferences, but would help for two cases: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.