Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Bug in ExtendScript’s Conditional (Ternary) Operator

Participant ,
Jul 24, 2025 Jul 24, 2025

 

ExtendScript’s conditional operator resolves expressions in the wrong order. In the case of:

true ? a : true ? b : c;

I would expect it to return a, but ExtendScript actually returns b. This behavior is a major source of latent bugs in scripts. It urgently needs to be fixed.

 

I first noticed this when injecting polyfills into legacy ExtendScript. Common minification plugins like terser convert if statements into ternary expressions. To avoid relying on polyfills, Adobe should either update ExtendScript to support at least ES2015 or fix this egregious bug.

Bug Unresolved
TOPICS
Scripting
289
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
4 Comments
Adobe Employee ,
Jul 24, 2025 Jul 24, 2025

If you use parens, does it help? e.g.

true ? a : (true ? b : c) 

 

Translate
Report
Participant ,
Jul 24, 2025 Jul 24, 2025

You're saying I should manually add parentheses after minifying?

Translate
Report
Adobe Employee ,
Jul 24, 2025 Jul 24, 2025

I'm just asking if adding the parens solves the order of operations that you're seeing? If it does, perhaps the minify tool could do that for you. I don't expect there will be a fix in a shortish timeframe, so just trying to help with a workaround. 

Translate
Report
Participant ,
Jul 24, 2025 Jul 24, 2025
LATEST

Sorry, I lost my cool there.
You're right—adding parentheses like that does make it work as expected.
However, many formatters and minify tools tend to remove such “unnecessary” parentheses.

Translate
Report