[UI Position 1.14.1] Uncaught SyntaxError: Missing initializer in using declaration
Closed this issue · 3 comments
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
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).
The issue only appears in the version of the browser installed from https://dl.google.com/chrome/mac/universal/stable/GGRO/googlechrome.dmg
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.
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.
Thank you, @dmethvin! I missed that it was declared above in the code.
Related issues: