jquery / jquery-ui

The official jQuery user interface library.
https://jqueryui.com
Other
11.26k stars 5.32k forks source link

[UI Position 1.14.1] Uncaught SyntaxError: Missing initializer in using declaration #2314

Closed alex-solovyev closed 2 days ago

alex-solovyev commented 6 days ago

I started encountering an error after upgrading Google Chrome to Version 131.0.6778.86 (Official Build) (x86_64).

The issue is reproducible only when using the uncompressed version of jQuery UI. The relevant code:

if (options.using) {
    // Adds feedback as the second argument to the using callback, if present
    using = function(props) {
      // skipped...
    };
}

It seems that the variable using is being used as a function without being declared properly. Adding var in front of using resolves the issue.

Example: CodePen link

alex-solovyev commented 4 days ago

That's odd, but I cannot reproduce the issue when using Google Chrome for Testing on the same laptop (macOS Monterey 12.7.6, Intel processor).

Screenshot 2024-11-25 at 13 50 40

The issue only appears in the version of the browser installed from https://dl.google.com/chrome/mac/universal/stable/GGRO/googlechrome.dmg

Screenshot 2024-11-25 at 14 08 19
dmethvin commented 2 days ago

There's a proposed new TC39 feature that creates a using keyword. https://github.com/tc39/proposal-explicit-resource-management

Based on the error message, it seems like the attempt to parse that line as a using statement is the cause. However, the current code is valid Javascript. That using variable is declared earlier in the scope.

image

I would report this problem to Chrome as a bug. Changing this line in jQuery UI will not really help, because there are so many sites using the current jQuery UI version that will not be updated. All of those sites would still be broken.

alex-solovyev commented 2 days ago

Thank you, @dmethvin! I missed that it was declared above in the code.

Related issues: