question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Clone node: Setting className for SVG element raises error

See original GitHub issue

Please make sure you are testing with the latest release of html2canvas. Old versions are not supported and issues reported for them will be closed.

Please follow the general troubleshooting steps first:

  • You are using the latest version
  • You are testing using the non-minified version of html2canvas and checked any potential issues reported in the console

Bug reports:

Setting className for SVG element will raise error, here’s some stack trace, I’m using the non minified js version. I thinks the reason is probably I’m using fontawesome 5 SVG icon

MY_PROJECT_PATH/lib/html2canvas.js:5304 Uncaught (in promise) TypeError: Cannot assign to read only property 'className' of object '#<SVGSVGElement>'
    at DocumentCloner.resolvePseudoContent (VM4414 html2canvas.js:5304)
    at DocumentCloner.cloneNode (VM4414 html2canvas.js:5200)
    at DocumentCloner.cloneNode (VM4414 html2canvas.js:5207)
    at DocumentCloner.cloneNode (VM4414 html2canvas.js:5207)
    at DocumentCloner.cloneNode (VM4414 html2canvas.js:5207)
    at DocumentCloner.cloneNode (VM4414 html2canvas.js:5207)
    at DocumentCloner.cloneNode (VM4414 html2canvas.js:5207)
    at DocumentCloner.cloneNode (VM4414 html2canvas.js:5207)
    at DocumentCloner.cloneNode (VM4414 html2canvas.js:5207)
    at DocumentCloner.cloneNode (VM4414 html2canvas.js:5207)
    at DocumentCloner.cloneNode (VM4414 html2canvas.js:5207)
    at DocumentCloner.cloneNode (VM4414 html2canvas.js:5207)
    at DocumentCloner.cloneNode (VM4414 html2canvas.js:5207)
    at DocumentCloner.cloneNode (VM4414 html2canvas.js:5207)
    at DocumentCloner.cloneNode (VM4414 html2canvas.js:5207)
    at DocumentCloner.cloneNode (VM4414 html2canvas.js:5207)
    at new DocumentCloner (VM4414 html2canvas.js:5006)
    at VM4414 html2canvas.js:6900
    at step (VM4414 html2canvas.js:83)
    at Object.next (VM4414 html2canvas.js:64)
    at VM4414 html2canvas.js:57
    at new Promise (<anonymous>)
    at __awaiter (VM4414 html2canvas.js:53)
    at renderElement (VM4414 html2canvas.js:6857)
    at html2canvas (VM4414 html2canvas.js:6854)

Specifications:

  • html2canvas version tested with: 1.0.0-rc3
  • Browser & version: Electron 4 / Chromium 69
  • Operating system: macOS

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:11
  • Comments:31

github_iconTop GitHub Comments

10reactions
lemmingapexcommented, Feb 17, 2020

@niklasvh, will you please release v1.0.0-rc.6 with this fix? What do you need to make this happen soon?

8reactions
lemmingapexcommented, Feb 26, 2020

@niklasvh, the community using this library expects more frequent updates than you are providing. (>3 months of inactivity) If you are unable to maintain this library on your own, please add some prominent contributors such as @andyedinborough and @cobexer as collaborators: https://github.com/niklasvh/html2canvas/settings/access. Maybe they can provide the maintenance and releases that this library needs. Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Clone node: Setting className for SVG element raises error
Please follow the general troubleshooting steps first: [x] You are using the latest version; [x] You are testing using the non-minified version ...
Read more >
Unable to change class name of SVG element - Stack Overflow
In HTML, className is a string. In SVG it is an SVGAnimatedString object. That's why you can't just do svgElement.className = "halffill" ....
Read more >
Set className throws error in Firefox - GSAP - GreenSock
The className attribute on SVGElement overrides the correspond attribute on Element, following the WebIDL rules for inheritance.
Read more >
[PATCH] NullPointerException calling cloneNode for SVG 1.2 ...
This means that in the newNode() method, we just call the parameterless constructor. To ensure that the fields of BindableElement are set, I ......
Read more >
The React Handbook – Learn React for Beginners
This is best when your React app will interact with the elements ... When anything in the chain of promises fails and raises...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found