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

fix: Guard access to window in helpers.dom.ts for browserless rendering #11588

Merged
merged 1 commit into from Nov 17, 2023

Conversation

unverbraucht
Copy link
Contributor

I'm rendering chart.js on node via chartjs-node-canvas. I found an issue where the window superglobal was accessed even if the DOM wasn't available and have fixed it with a simple guard.

The access is in a try-catch-block which seems to check if event listeners can be added and removed. Since access to window outside of the browser doesn't raise a catcheable error this would fail fatally outside of the browser.

I can provide a test project with chartjs-node-canvas but for this simple fix I was hoping that the bugfix is acceptable without it :)

@LeeLenaleee LeeLenaleee merged commit e92d104 into chartjs:master Nov 17, 2023
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants