- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 222
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
"eval" in a Window is always scoped to the Window #1025
Labels
bug
Something isn't working
Comments
I found that the
Test case:
In browser:
In happy-dom:
|
joeframbach
added a commit
to joeframbach/happy-dom
that referenced
this issue
Aug 25, 2023
joeframbach
added a commit
to joeframbach/happy-dom
that referenced
this issue
Aug 25, 2023
joeframbach
added a commit
to joeframbach/happy-dom
that referenced
this issue
Aug 25, 2023
joeframbach
added a commit
to joeframbach/happy-dom
that referenced
this issue
Aug 25, 2023
Thanks again for reporting and contributing @joeframbach! 🙂 There is a fix released now. You can read more about it here: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
eval
has two modes -- a "direct" eval which has access to local scope, and an "indirect" eval which has access only to global scope. Theeval
which executes in a HappyDom document is indirect-only. Behavior in Happy-Dom is different from a real browser.To Reproduce
Steps to reproduce the behavior:
Execute the script in node:
See output
Then execute this script in a browser:
See output
Expected behavior
Expected to see "globalVariableValue" and "localVariableValue" in both node and browser.
Screenshots
If applicable, add screenshots to help explain your problem.
N/A
Device:
happy-dom 10.11.0
Additional context
Add any other context about the problem here.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval#direct_and_indirect_eval
The text was updated successfully, but these errors were encountered: