#1737·jsdom

window DOM classes should be instanceof window.Function

Author: klarkcCreated Feb 16, 2017Updated Sep 17, 2026

Hello, I found this issue when I was trying to use a CustomElements api polyfill with jsdom. The polyfill validates element definition by checking instanceof passed classes.

It seems that all DOM HTML classes are instanceof window.Function (at least in my browsers): https://jsfiddle.net/0gxdxcpu/

With jsdom:

javascript
jsdom.jsdom(
    '<script>console.log(window.HTMLElement instanceof window.Function)</script>',
    {virtualConsole: jsdom.createVirtualConsole().sendTo(console)}
);

the console output is false