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

Browser retro compatibility before 2020 : ||= operator #16922

Closed
Name-less opened this issue Aug 14, 2024 · 3 comments
Closed

Browser retro compatibility before 2020 : ||= operator #16922

Name-less opened this issue Aug 14, 2024 · 3 comments
Labels
resolution:wontfix This issue will not be fixed because the team decided that for given reasons it does not make sense. type:improvement This issue reports a possible enhancement of an existing feature.

Comments

@Name-less
Copy link

Name-less commented Aug 14, 2024

📝 Browser compatibility under 2020

The last version of ckeditor is not working for browser versions under 2020 because of the new operator ||= which is present only once on the ckeditor project.

This is problematic for a lot of our users that have old computers and browsers.

Please, on the function _copySelectedFragmentWithMarkers replace :
fakeMarkersRangesInsideRange[markerName] ||= writer.createRangeIn(fragment);

By :
if(fakeMarkersRangesInsideRange[markerName] == undefined){
fakeMarkersRangesInsideRange[markerName] = writer.createRangeIn(fragment);
}

And this will work like a charm for older browsers.

For more informations about the ||= operator, see :
https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Operators/Logical_OR_assignment

📃 Other details

  • Browser: Every browser older than 2020
  • OS: every OS
  • CKEditor version: 5

If you'd like to see this improvement implemented, add a 👍 reaction to this post.

@Name-less Name-less added the type:improvement This issue reports a possible enhancement of an existing feature. label Aug 14, 2024
@Reinmar
Copy link
Member

Reinmar commented Aug 14, 2024

Hi :) We should probably do a better job at communicating which browsers we intend to support. But 4y old ones won't be on the list for sure.

In this case, this may be a single operator now, but this is a large project and we guard the ES features used by defining the target ES version when compiling everything together. If you meant that we could easily remove the use of this operator – yes, we can. But it may return next week in someone else's code (including our deps).

Anyways, the solution is to use Babel when integrating CKE5 to transpile the code down to the ES version that you want to target. You know your audience and how backwards-compatible you want your product to be.

@Reinmar Reinmar closed this as completed Aug 14, 2024
@Reinmar Reinmar added the resolution:wontfix This issue will not be fixed because the team decided that for given reasons it does not make sense. label Aug 14, 2024
@Name-less
Copy link
Author

Thanks for your answer, a better solution is to use an alternative that respect backwards compatibility like https://www.tiny.cloud/: )

@Reinmar
Copy link
Member

Reinmar commented Aug 18, 2024

TinyMCE has a very similar approach to supporting old browsers to us: https://www.tiny.cloud/docs/tinymce/latest/support/

And, once again, you can use Babel to ensure compatibility (at least from the syntax perspective) with the old browser engines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution:wontfix This issue will not be fixed because the team decided that for given reasons it does not make sense. type:improvement This issue reports a possible enhancement of an existing feature.
Projects
None yet
Development

No branches or pull requests

2 participants