tinymce icon indicating copy to clipboard operation
tinymce copied to clipboard

Strange use of logical not in tinymce/assets/js/tinymce_rex.js line 40

Open rotdrop opened this issue 2 years ago • 0 comments

The following lines probably do not what was intended:

https://github.com/FriendsOfREDAXO/tinymce/blob/ebf1066d0260bb629bb99d8d33271a554305f570/assets/js/tinymce_rex.js#L40

https://github.com/FriendsOfREDAXO/tinymce/blob/ebf1066d0260bb629bb99d8d33271a554305f570/assets/js/tinymce_rex.js#L55

What happens here is the following:

  1. typeof media_type is evaluated to some string
  2. !(typeof media_type) is evaluated to a boolean value, namely false as any string treated as boolean is logically true hence its negation is false
  3. !(typeof media_type) === 'undefined' is evaluated to false
  4. hence the complete expression evaluates to mediaPath always

BTW, mediaManagerPath seemingly is not defined.

rotdrop avatar May 21 '23 10:05 rotdrop