Search code examples
phpjqueryjquery-mobileckfinder

CKFinder error when running with jQuery 3.x


It appears that CKFinder 3.3 (for PHP) is not compatible with jQuery 3.0 or 3.1. Whenever I try to load CKFinder with either of those versions, I get these two errors and CKFinder does not load:

[Error] TypeError: undefined is not an object (evaluating 'a.event.props.concat')
    (anonymous function) (jquery.mobile.js:4:5781)
    (anonymous function) (jquery.mobile.js:4:6334)
    (anonymous function) (jquery.mobile.js:3:115)
    global code (jquery.mobile.js:3:130)
[Error] TypeError: undefined is not an object (evaluating 't.event.special.swipe.start')
init — ckfinder.js:3373
(anonymous function) — ckfinder.js:14863:116
execCb — ckfinder.js:715
check — ckfinder.js:510
enable — ckfinder.js:589
init — ckfinder.js:482:172
(anonymous function) — ckfinder.js:648:99

    check (ckfinder.js:5:21940)
    enable (ckfinder.js:5:24481)
    init (ckfinder.js:5:20742)
    (anonymous function) (ckfinder.js:5:26286)

If I revert to jQuery 1.12.3 (with no other changes), it works fine.

One of the errors occurs within jQuery mobile, so it could be a problem inside that, however, that is the latest version (1.4.5) and I've not found any reports about incompatibilities between jQuery mobile and jQuery 3. I also tried using th jQuery migrate plugin, but that did not help.

I can work around the problem by telling CKFinder to use jQuery 1.12 while the page it's embedded in uses 3.1, however, it's obviously not ideal to have to load two copies of jQuery.


Solution

  • Just a note here, as answered on the ticket https://github.com/ckfinder/ckfinder/issues/299#issuecomment-239440766

    Latest jQuery Mobile Framework 1.4.5 was released on 31 Oct 2014. It was before jQuery 2.2, which is not supported yet https://github.com/jquery/jquery-mobile/issues/8381. Also before any jQuery 3.x releases: 3.0 - released on June 9, 2016; 3.1 - released on July 7, 2016.

    As the docs stands:

    jQuery Mobile 1.4.x works with versions of jQuery core from 1.8.3 to 1.11.1 / 2.1.1.

    So, until jQuery Mobile isn't compatible with jQuery 3.x itself, CKFinder won't work with it neither.