You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
console.log(`Object.getOwnPropertyNames(window).filter((k) => k === "HTMLElement").length`,Object.getOwnPropertyNames(window).filter((k)=>k==="HTMLElement").length);// 1
Additional information
I've yet to understand why, but the runScripts: 'dangerously', is causing this problem. When I comment that out, the console.log prints 1, just like a browser.
I created this StackOverflow question before creating this issue. It might provide some helpful context, and it includes additional log statements showing similarities between the two environments. For example, window.HTMLElement have equivalent property descriptors in both.
I don't fully understand the ramifications of these differences, but it made it challenging to troubleshoot the JSDOM error I was experiencing at the bottom of that SO example.
I tested this in Firefox and Google Chrome and both print 1.
The text was updated successfully, but these errors were encountered:
DanKaplanSES
changed the title
Browsers return DOM property names in Object.getOwnPropertyNames(window). JSDOM does not. Object.getOwnPropertyNames(window) returns DOM property names in browsers. JSDOM does not.
Mar 1, 2024
DanKaplanSES
changed the title
Object.getOwnPropertyNames(window) returns DOM property names in browsers. JSDOM does not. Object.getOwnPropertyNames(window) returns DOM property names in browsers. Object.getOwnPropertyNames(jsdom.window) does not.
Mar 1, 2024
DanKaplanSES
changed the title
Object.getOwnPropertyNames(window) returns DOM property names in browsers. Object.getOwnPropertyNames(jsdom.window) does not. runScripts: 'dangerously' changes the output of Object.getOwnPropertyNames(jsdom.window)Mar 1, 2024
Basic info:
Minimal reproduction case
How does similar code behave in browsers?
Additional information
I've yet to understand why, but the
runScripts: 'dangerously'
, is causing this problem. When I comment that out, the console.log prints1
, just like a browser.I created this StackOverflow question before creating this issue. It might provide some helpful context, and it includes additional log statements showing similarities between the two environments. For example,
window.HTMLElement
have equivalent property descriptors in both.I don't fully understand the ramifications of these differences, but it made it challenging to troubleshoot the JSDOM error I was experiencing at the bottom of that SO example.
I tested this in Firefox and Google Chrome and both print
1
.The text was updated successfully, but these errors were encountered: