-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
ReferenceError: SVGPathElement is not defined #5379
Comments
Looks like it's not implemented in JSDOM: https://github.com/tmpvar/jsdom/tree/master/lib/jsdom/living/nodes You should definitely move this issue there, as they would be the ones to build support. In the meantime, you can monkeypatch support in a setup file like this I think? class SVGPathElement extends HTMLElement {}
window.SVGPathElement = SVGPathElement |
Thanks @probablyup! The issue should indeed be raised over there. |
thanks guys, I'm going to move it in there. BTW, I solved it with a similar approach, adding the missing classes to |
@marinho Agree that jsdom is the place to raise the issue. I am interested to understand:
|
hi @pedrottimark, I'm calling a function that internally call some of the polyfilled methods, but I don't need the function itself, so, I solved it by creating It works, although I will try to implement it in jsdom as a better practice. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Basics
What is the current behavior?
When using path-data-polyfill.js, it uses
SVGPathElement.prototype
to add methods that were removed from SVG API in Chrome (i.e.getPathData
,setPathData
and others).When running Jest with jsdom, it complains
ReferenceError: SVGPathElement is not defined
.I made a quick search in jsdom source code and couldn't find any mention to
SVGPathElement
Not only
SVGPathElement
is missing but alsoSVGRectElement
,SVGCircleElement
,SVGEllipseElement
,SVGLineElement
,SVGPolylineElement
andSVGPolygonElement
.As I'm using jsdom only for running Jest tests and compilation through tsc works fine, I guessed the right place to report this issue was in here - not in jsdom repo - please correct me if I am wrong.
What is the expected behavior?
I would expect any SVG basic element class to be present when running tests with Jest.
This is how my
--debug
did output config:The text was updated successfully, but these errors were encountered: