-
-
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
Fix DOMElement plugin to format SVG in jsdom 11 #4664
Conversation
Great! This fixes both the OOM and the |
Yes, I ran
|
Codecov Report
@@ Coverage Diff @@
## master #4664 +/- ##
==========================================
- Coverage 57.13% 56.17% -0.97%
==========================================
Files 194 194
Lines 6565 6544 -21
Branches 3 3
==========================================
- Hits 3751 3676 -75
- Misses 2814 2867 +53
- Partials 0 1 +1
Continue to review full report at Codecov.
|
That's production code (middle of https://www.finn.no/). I did press autoformat in intellij though, so some of the indent is from there.
😱 thanks for noticing! |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
Fixes #4645
An SVG element has constructor name:
HTMLUnknownElement
in jsdom 9 and jsdom 10Element
in jsdom 11The regexp has always had
?
but it didn’t work as intended without parentheses.Therefore
pretty-format
attempted to serialize SVG elements as ordinary objects.Test plan
Added a test (which failed first) to match
Element
asval.constructor.name
@SimenB Thank you for outstanding example of repro repo!
For your info, I rewrote
{ plugins: prettyFormat.plugins }
becauseplugins
option value needs to be an array butplugins
prop value is an object :)