Skip to content
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

Using DOM.js library kills console.log #3386

Open
jht9629-nyu opened this issue Mar 12, 2025 · 6 comments
Open

Using DOM.js library kills console.log #3386

jht9629-nyu opened this issue Mar 12, 2025 · 6 comments
Labels

Comments

@jht9629-nyu
Copy link

jht9629-nyu commented Mar 12, 2025

p5.js version

1.11.1

What is your operating system?

Mac OS

Web browser and version

133.0.6943.127 (Official Build) (arm64)

Actual Behavior

  1. open https://editor.p5js.org/jht9629-nyu/sketches/VY-KQxJkA
  2. run
  3. error appears in console:
  4. "RangeError: Maximum call stack size exceeded"

Expected Behavior

  1. comment out DOM.js include in index.html
  2. run script and console now shows expected messages:
pre setup 
in setup 
in draw 

Steps to reproduce

Steps:

  1. open https://editor.p5js.org/jht9629-nyu/sketches/VY-KQxJkA
  2. run
  3. error appears in console:
  4. "RangeError: Maximum call stack size exceeded"

Snippet:

Just the include of lenincompres/DOM.js causes simple console.log fails, eg:

function setup() {
  console.log('in setup');
}

DOM.js is a library by lenincompres included in the index.html
<script src="https://cdn.jsdelivr.net/gh/lenincompres/DOM.js@latest/DOM.js"></script>
Issue is also logged on his repo for the library:
lenincompres/DOM.js - console.log failure issue

@afthal-ahamad01
Copy link

@jht9629-nyu This issue could be due to a recursive function that doesn't have an appropriate exit condition. causing the call stack to overflow. I'll look into it further to identify the root cause and confirm if that's the issue.

@jht9629-nyu
Copy link
Author

The core problem is why is stack overflow triggered in p5js editor and not in standalone environment?
Using console.log is essential for debugging so would be great to get it to work when using the DOM.js library in the p5js editor.
More details on the DOM.js library here

@dipamsen
Copy link
Contributor

Seems to be same problem as #3178

@jht9629-nyu
Copy link
Author

Seems to be same problem as #3178

I don't think so. There is no circular reference involved in this case. Just the presence of the library include of DOM.js causes simple console.log commands link this to fail:
console.log('in setup');

DOM.js is a library by lenincompres
included with this line in the index.html
<script src="https://cdn.jsdelivr.net/gh/lenincompres/DOM.js@latest/DOM.js"></script>
Issue is also logged on his repo for the library:
lenincompres/DOM.js - console.log failure issue

@dipamsen
Copy link
Contributor

You are right, that issue I linked is not relevant. Upon further analysis I have found the actual issue and described it in the DOM.js issue.

@jht9629-nyu
Copy link
Author

@dipamsen Thank you greatly for your detailed analysis and recommendation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants