Turns out that I recently migrated this article to Joomla 4.1.1 (so far) as part of my website upgrade attempt and the script breaks.
Looking into what was saved, I figured that the select "onChange" element was transformed into "on-change"!
I then tried with a basic minimum code indicated below (nothing fancy) and here's what came out after save:
I have tried to see if this could come from the editor I use, switching from JCE to TinyMCE, with no luck.
Could this be looking like a Joomla 4 "uncommented feature"?