Skip to content

Preserve noprotect when changing the p5.js library version - #4312

Closed
dyk1454683243-sudo wants to merge 1 commit into
processing:developfrom
dyk1454683243-sudo:cursor/preserve-noprotect-on-version-change-4303-f42b
Closed

dyk1454683243-sudo wants to merge 1 commit into
processing:developfrom
dyk1454683243-sudo:cursor/preserve-noprotect-on-version-change-4303-f42b

Conversation

@dyk1454683243-sudo

Copy link
Copy Markdown

Issue:

Fixes #4303

Changing the p5.js library version in Preferences rewrites index.html through documentElement.outerHTML. That serialization drops comments outside <html>, including a leading <!-- noprotect -->, so Loop Protection Off flips back to On. The same rewrite path is used by addon toggles.

Demo:

No visual UI change. Loop Protection Off (<!-- noprotect --> present) now survives a library version change; Loop Protection On still does not insert a noprotect comment.

Changes:

  • Add preserveNoProtect() so HTML rewrites keep an existing noprotect comment and do not invent one.
  • Use it in useP5Version serializeResult(), which replaceVersion and the addon setters already share.
  • Preferences handleLoopProtection(true) still removes noprotect through toggleLoopProtection and is unchanged.
  • Unit tests: with noprotect → replaceVersion keeps it; without → stays without; addon setters do not drop it.

This is a separate branch from #4309 / #4311.

I have verified that this pull request:

  • has no linting errors (npm run lint)
  • has no test errors (npm run test)
  • has no typecheck errors (npm run typecheck)
  • is from a uniquely-named feature branch and is up to date with the develop branch.
  • is descriptively named and links to an issue number, i.e. Fixes #4303
  • meets the standards outlined in the accessibility guidelines

Version and addon HTML rewrites serialize via documentElement.outerHTML,
which drops comments outside <html> and flips the Loop Protection toggle.
Restore the existing <!-- noprotect --> flag after serialization.

Fixes processing#4303

Co-authored-by: David <dyk1454683243-sudo@users.noreply.github.com>
@dyk1454683243-sudo

Copy link
Copy Markdown
Author

Withdrawing this PR while I clean up a high-volume open-PR backlog. Sorry for the noise — happy to come back later with a focused change if useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Infinite loop protection is switched on when changing library version

1 participant