jQuery 1.9 incompatibility (jQuery.browser removed)

2,223 views
Skip to first unread message

george....@gmail.com

unread,
Jan 20, 2013, 10:29:53 PM1/20/13
to cled...@googlegroups.com
I have jQuery 1.9 automatically included by the framework (jquery-rails, twitter-bootstrap-rails etc)
It appears that CLeditor uses deprecated stuff that has been removed in 1.9.
Notably the jQuery.browser object.

I have got over this using the jquery-browser plugin which appears to fix the issue but I wondered if there were any other problems that I should be aware of with 1.9 and whether CLeditor will get an update sometime?

G.

Simon

unread,
Feb 17, 2013, 4:03:26 AM2/17/13
to cled...@googlegroups.com
Quickfix should be to edit line 156:

old   ie = $.browser.msie,
new ie = /msie/i.test(navigator.userAgent),

kahalaco...@gmail.com

unread,
Apr 4, 2013, 10:41:36 AM4/4/13
to cled...@googlegroups.com
The bigger question is, "Will this project ever be updated?"  Is it still an active project?   The last release looks like 2010... so ,"not an active project?"  If I can't find a better solution then I may have to fork the code and support it myself (for internal projects) but I'd rather not.  

kahalaco...@gmail.com

unread,
Apr 4, 2013, 10:44:55 AM4/4/13
to cled...@googlegroups.com
That fix does not work.  $.browser is deprecated and has been removed in the latest jquery.  It is used multiple times in the cleditor code.


On Sunday, February 17, 2013 2:03:26 AM UTC-7, Simon wrote:

Jan

unread,
Apr 4, 2013, 4:38:01 PM4/4/13
to cled...@googlegroups.com
I added this to my javascript and then it works. You don't have to change anything in the cleditor code.

jQuery.uaMatch = function( ua ) {
ua = ua.toLowerCase();
var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
    /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
    /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
    /(msie) ([\w.]+)/.exec( ua ) ||
    ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
    [];
return {
    browser: match[ 1 ] || "",
    version: match[ 2 ] || "0"
};
};
if ( !jQuery.browser ) {
matched = jQuery.uaMatch( navigator.userAgent );
browser = {};
if ( matched.browser ) {
    browser[ matched.browser ] = true;
    browser.version = matched.version;
}
// Chrome is Webkit, but Webkit is also Safari.
if ( browser.chrome ) {
    browser.webkit = true;
} else if ( browser.webkit ) {
    browser.safari = true;
}
jQuery.browser = browser;

george....@gmail.com

unread,
Apr 4, 2013, 4:56:47 PM4/4/13
to cled...@googlegroups.com
The recommended way to handle this sort of issue now appears to be the jQueryMigrate plugin.
Include the jquery-migrate js code after jquery is loaded but before other libraries such as cleditor.

It will do two things, warn you of the deprecated / obsolete code and also allow that code to run.
For example the output in my console when using jqeuery-migrate with cleditor looks as follows:
JQMIGRATE: Logging is active jquerymigrate.js:22
JQMIGRATE: jQuery.browser is deprecated jquerymigrate.js:41
  1. console.trace() jquerymigrate.js:43
    1. Object.defineProperty.getjquerymigrate.js:58
    2. (anonymous function)jquery.cleditor.js:156
    3. (anonymous function)jquery.cleditor.js:1132
G.


Andrés Fraguela Cuesta

unread,
Apr 21, 2013, 2:46:54 PM4/21/13
to cled...@googlegroups.com
Browse for ".browse" (without the double quote) within the code of the files "jquery.cleditor.js" or "jquery.cleditor.min.js", depending of which one are you using, and replace it with ".support". That is all.

Chris Landowski

unread,
Jun 14, 2013, 7:57:57 PM6/14/13
to cled...@googlegroups.com
This problem was fixed in version 1.4.0.
Reply all
Reply to author
Forward
0 new messages