Visitar URL original
"TypeError: Assignment to constant variable" when testing some URLs · Issue #321 · squizlabs/HTML_CodeSniffer · GitHub
Skip to content

"TypeError: Assignment to constant variable" when testing some URLs #321

Open

Description

@malcomio

Steps to reproduce

  1. install the bookmarklet
  2. visit one of the following URLs:
    1. https://www.transizionedigitale.it/
    2. https://www.neso.energy/
  3. click the bookmarklet

Expected result

The sniffer should run and report any issues

Actual result

The test does not complete
Errors in console:

Uncaught TypeError: Assignment to constant variable.
    at Object.testNullAltText (HTMLCS.js:24:223570)
    at Object.addNullAltTextResults (HTMLCS.js:24:222007)
    at Object.process (HTMLCS.js:24:221802)
    at m (HTMLCS.js:24:288483)
    at c (HTMLCS.js:24:288090)
    at Object.run (HTMLCS.js:24:287448)
    at HTMLCS.js:24:286284
    at HTMLCS.js:24:286545
    at h (HTMLCS.js:24:289153)
    at HTMLCS.js:24:289131

Originally raised as pa11y/pa11y#709

Activity

  1. malcomio commented on Dec 19, 2024

    @malcomio
    Author

    Using a debug version, the output is as follows:

    HTMLCS.js:2758  Uncaught TypeError: Assignment to constant variable.
        at Object.testNullAltText (HTMLCS.js:2758:18)
        at Object.addNullAltTextResults (HTMLCS.js:2711:27)
        at Object.process (HTMLCS.js:2698:18)
        at _processSniffs (HTMLCS.js:5414:23)
        at _run (HTMLCS.js:5387:17)
        at Object.run (HTMLCS.js:5338:13)
        at HTMLCS.js:5259:24
        at HTMLCS.js:5282:22
        at _registerSniffs (HTMLCS.js:5465:22)
        at HTMLCS.js:5470:13
    
  2. added a commit that references this issue on Dec 19, 2024
    b7ce8d1
  3. added a commit that references this issue on Jul 8, 2025
  4. GRASPARK commented on Nov 17, 2025

    @GRASPARK

    @malcomio

    I have checked both links and confirmed the following:

    It appears that the issue with the second link is related to the presence of a Content Security Policy (CSP), which is preventing the code-sniffing method from functioning correctly.

    For your reference, CSP is enabled on the second link but not on the first.

    If you need any more details than please share me screenshot to help you with.

  5. malcomio commented on Nov 17, 2025

    @malcomio
    Author

    thanks @GRASPARK that makes sense - the problem seems to be addressed by the changes in #322

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

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