Skip to content

Cleaning page content causes severe javascript freezes #505

@LucExitable

Description

@LucExitable

Hi there,

One of our clients has the following issue:

They have an entry with the SEO field that has at least 1 keyword defined. Periodically the SEO plugin analyses the page contents to rank the keyword. Part of that analysis is pumping the raw html of the frontend page though the static cleanText (text) function in the TextStatistics.js file. This seems to be triggered via the recalculateKeyword function in FocusKeywords.js.

The cleanText function does a bunch of regex replacements on the raw page source. That's a string that can be as much as 157kb in size. This causes the browser to hang for about 2 - 3 seconds.

The above appears to be present in both Craft CMS 4 and 5 versions of the plugin.

Website details:

Craft CMS 4.16.13 Multisite with 8 sites.
SEO plugin 4.2.4

Steps to reproduce:

  1. Have an entry with a lot of content so the html is of decent size.
  2. Enter 1 or more keywords in the Seo field
  3. Observe the freezes when switching editor tabs and periodically (I think when Craft CMS checks for changes?)

Thanks in advance for looking into this!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions