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

Autodetect in highlight.js with language-php-template causes infinite loop #103

Open
WebCoder49 opened this issue May 27, 2024 · 0 comments

Comments

@WebCoder49
Copy link
Owner

To reproduce this:

  • Open the highlight.js code-input Tester page and answer the confirmation dialogs.
  • Delete all of the code from the code-input element at the bottom of the page and replace it with <abc>
  • Look in DevTools. The code element's classes and its contents update every single frame.
    Screenshot. The code-input pre code element is flashing black on blue.
  • Add a long string of as to the end of the <abc> so the textarea begins to scroll horizontally; you now can't scroll back to the left without moving the cursor to the left. This is very likely due to the blur/focus to move to the caret lines of code in the update function.

This occurs in both Chrome and Firefox.

My suspicions are that the update function is being called every frame. The code-input library removes the highlighted="yes" attribute on the pre code in order to be able to highlight text live, but this might be causing problems with recursion present in PHP template language. This does not occur with autodetected JavaScript.

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

No branches or pull requests

1 participant