onclone is not working
See original GitHub issueBug reports:
I want to change the display property of myDiv from none
to block
inside the cloned document. The reason to do this is that I want to hide my div in the actual dom. When I am trying to use onclone option of html2canvas, to change the property it is not reflecting. Can someone please check if I am missing something here? Please find below the link to the reproducer.
Specifications:
- html2canvas version tested with: 1.0.0-rc.7
- Browser & version: Chrome 87
- Operating system: Windows 10
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:6 (1 by maintainers)
Top Results From Across the Web
html2canvas Option onclone Not Working as Expected with ...
It seems that the issue is due to the fact that the styles of the clone element used by jsPDF keep the same...
Read more >Screenshot of hidden div using html2canvas
html2canvas provides an option called 'onclone' by passing the cloned document. You can set the visibility of your hidden ...
Read more >How to use the html2canvas function in html2canvas
Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues...
Read more >oncopy Event
The oncopy event occurs when the user starts a copy process in the browser. The oncopy event occurs when the user copies element...
Read more >Window onClose not working in KendoReact
The problem is that clicking the X to close the popup doesn't do anything at all. Maximize and minimize work, but not the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The
onclone
is working, but as you are rendering an element withdisplay:none
, it has no width/height. Changing it to usevisibility
and it works justs fine: https://codesandbox.io/s/xenodochial-northcutt-002g6?file=/src/App.jsUsing the visibility property worked me for me as well! Using the display property was causing some issues, for example sometimes the font was not correctly rendered.