diff --git a/CHANGES.md b/CHANGES.md index 7dab4384d77..7fa6c7039c5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -27,6 +27,7 @@ Fixed Issues: Other Changes: * [#10903](http://dev.ckeditor.com/ticket/10903): Performance improvements for [`addClass`](http://docs.ckeditor.com/#!/api/CKEDITOR.dom.element-method-addClass), [`removeClass`](http://docs.ckeditor.com/#!/api/CKEDITOR.dom.element-method-removeClass) and [`hasClass`](http://docs.ckeditor.com/#!/api/CKEDITOR.dom.element-method-hasClass) methods. +* [#11856](http://dev.ckeditor.com/ticket/11856): jQuery adapter throw an meaningful error if CKEditor or jQuery is not loaded. ## CKEditor 4.4.7 diff --git a/adapters/jquery.js b/adapters/jquery.js index 73c31a819f6..2b5ac074f5b 100644 --- a/adapters/jquery.js +++ b/adapters/jquery.js @@ -19,6 +19,14 @@ */ ( function( $ ) { + if ( typeof $ == 'undefined' ) { + throw new Error( 'jQuery should be loaded before CKEditor adapter. Have you mistaken loaded scripts order?' ); + } + + if ( typeof CKEDITOR == 'undefined' ) { + throw new Error( 'CKEditor core should be loaded before jQuery adapter. Have you mistaken loaded scripts order?' ); + } + /** * Allows CKEditor to override `jQuery.fn.val()`. When set to `true`, the `val()` function * used on textarea elements replaced with CKEditor uses the CKEditor API. @@ -47,9 +55,6 @@ : CKEDITOR.config.jqueryOverrideVal; - if ( typeof $ == 'undefined' ) - return; - // jQuery object methods. $.extend( $.fn, { /** diff --git a/tests/adapters/jquery/manual/nockeditor.html b/tests/adapters/jquery/manual/nockeditor.html new file mode 100644 index 00000000000..8cd0556e2f0 --- /dev/null +++ b/tests/adapters/jquery/manual/nockeditor.html @@ -0,0 +1,3 @@ + diff --git a/tests/adapters/jquery/manual/nockeditor.md b/tests/adapters/jquery/manual/nockeditor.md new file mode 100644 index 00000000000..ca9f021c996 --- /dev/null +++ b/tests/adapters/jquery/manual/nockeditor.md @@ -0,0 +1,4 @@ +@bender-ckeditor-adapters: jquery +@bender-tags: 4.5.0, tc, jquery + +There should be an error telling that `CKEditor core should be loaded before jQuery adapter`. \ No newline at end of file diff --git a/tests/adapters/jquery/manual/nojquery.html b/tests/adapters/jquery/manual/nojquery.html new file mode 100644 index 00000000000..3d89fe5528a --- /dev/null +++ b/tests/adapters/jquery/manual/nojquery.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/tests/adapters/jquery/manual/nojquery.md b/tests/adapters/jquery/manual/nojquery.md new file mode 100644 index 00000000000..b00ea411c9a --- /dev/null +++ b/tests/adapters/jquery/manual/nojquery.md @@ -0,0 +1,3 @@ +@bender-tags: 4.5.0, tc + +There should be an error telling that `jQuery should be loaded before CKEditor adapter`. \ No newline at end of file