Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False in event data is incorrectly handled as an event cancellation #4652

Closed
Comandeer opened this issue Apr 29, 2021 · 1 comment
Closed
Assignees
Labels
core The issue is caused by the editor core code. status:confirmed An issue confirmed by the development team. type:bug A bug.
Milestone

Comments

@Comandeer
Copy link
Member

Type of report

Bug

Provide detailed reproduction steps (if any)

  1. Open console.
  2. Go to https://jsfiddle.net/Comandeer/xc3jqt6n/
  3. Look into the console.

Expected result

Both 1 and 2 are logged.

Actual result

Only 1 is logged.

Other details

  • CKEditor version: 4.5.0+

It seems that false passed as event data is treated the same way as the marker of event cancellation (

ckeditor4/core/event.js

Lines 310 to 318 in 2ed7789

if ( retData === false )
canceled = 1;
else if ( typeof retData != 'undefined' )
data = retData;
// No further calls is stopped or canceled.
if ( stopped || canceled )
break;
}
). The issue seems to be easily fixable by introducing event cancellation marker (just an empty object), which will be returned instead of false in case of event cancellation. Thanks to properties of object (they equal only themselves), we will be able to differentiate between cancelling events and event data set to false.

@Comandeer Comandeer added type:bug A bug. status:confirmed An issue confirmed by the development team. core The issue is caused by the editor core code. labels Apr 29, 2021
@CKEditorBot
Copy link
Collaborator

Closed in #4656

@CKEditorBot CKEditorBot added this to the 4.16.1 milestone May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core The issue is caused by the editor core code. status:confirmed An issue confirmed by the development team. type:bug A bug.
Projects
None yet
Development

No branches or pull requests

3 participants