Skip to content

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

@WebCoder49

Description

@WebCoder49

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:coreA bug/feature for the core code-input.js/code-input.css filesbugSomething isn't workingpriority:low

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions