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: #1868 Clone node, Setting className for SVG element raises error #2034

Closed
wants to merge 1 commit into from

Conversation

hal1984
Copy link

@hal1984 hal1984 commented Oct 15, 2019

Summary

This PR fixes/implements the following bugs/features

Explain the motivation for making this change. What existing problem does the pull request solve?

See #1868. The definition of className differs for Element and SVGElement. In Element className it is a string, but in SVG element class name it is a instance of SVGAnimatedString.

References: https://developer.mozilla.org/en-US/docs/Web/API/Element/className
https://developer.mozilla.org/en-US/docs/Web/API/SVGAnimatedString

Code formatting

Please make sure that code adheres to the project code formatting. Running npm run format will automatically format your code correctly.

Closing issues

fixes #1868
closes #1868

@niklasvh
Copy link
Owner

Thanks for the PR! I did a small update to it in #2079

@niklasvh niklasvh closed this Nov 26, 2019
@JohnJ255
Copy link

JohnJ255 commented Feb 11, 2020

Same for SVGSVGElement
image
html2canvas v1.0.0-rc.5
Uncaught (in promise) TypeError: Cannot assign to read only property 'className' of object '#<SVGSVGElement>'
at DocumentCloner.resolvePseudoContent (document-cloner.ts:412)
at DocumentCloner.cloneNode (document-cloner.ts:274)
at DocumentCloner.cloneNode (document-cloner.ts:284)
at DocumentCloner.cloneNode (document-cloner.ts:284)
at DocumentCloner.cloneNode (document-cloner.ts:284)
at DocumentCloner.cloneNode (document-cloner.ts:284)
at DocumentCloner.cloneNode (document-cloner.ts:284)
at DocumentCloner.cloneNode (document-cloner.ts:284)
at DocumentCloner.cloneNode (document-cloner.ts:284)
at DocumentCloner.cloneNode (document-cloner.ts:284)
at new DocumentCloner (document-cloner.ts:54)
at index.ts:81
at step (tslib.es6.js:97)
at Object.next (tslib.es6.js:78)
at tslib.es6.js:71
at new Promise ()
at __awaiter (tslib.es6.js:67)
at renderElement (index.ts:30)
at html2canvas (index.ts:23)

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

Successfully merging this pull request may close these issues.

Clone node: Setting className for SVG element raises error
4 participants