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
SVGGElement is not defined #2734
Labels
Comments
|
Yep. This is indeed a bug. The specification does not seem to be correctly implemented for SVG groups. <!DOCTYPE html>
<html>
<body>
<svg id="svg">
<g id="group"></g>
</svg>
<script>
"use strict";
window.addEventListener("load", function() {
const svg = document.getElementById("svg");
const group = document.getElementById("group");
console.dir(svg.constructor); // ƒ SVGSVGElement()
console.dir(group.constructor); // ƒ SVGGElement()
});
</script>
</body>
</html> "use strict";
const { JSDOM } = require("jsdom");
const dom = new JSDOM(`
<svg id="svg">
<g id="group"></g>
</svg>
`);
const svg = dom.window.document.getElementById("svg");
const group = dom.window.document.getElementById("group");
console.log(svg.constructor); // [Function: SVGSVGElement]
console.log(group.constructor); // [Function: SVGElement] |
Indeed, looks like this is just because we don't support the SVG |
TimothyGu
added a commit
to TimothyGu/jsdom
that referenced
this issue
Mar 28, 2020
Namely, <defs>, <desc>, <g>, <metadata>, and <switch>. Fixes jsdom#2734.
11 tasks
TimothyGu
added a commit
to TimothyGu/jsdom
that referenced
this issue
Jul 18, 2021
Namely, <defs>, <desc>, <g>, <metadata>, and <switch>. Fixes jsdom#2734.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I guess SVGGElement (MDN documentation) is not supported in jsdom ?
Basic info:
Minimal reproduction case
How does similar code behave in browsers?
https://jsfiddle.net/p3ag4v85/
(check in the console and look for
ok
)Notes
I have to say that I noticed the bug when I tested my code using Jest, that is using jsdom internally. Here is the error I got:
The text was updated successfully, but these errors were encountered: