Breaks with jQuery 1.9 due to use of $.browser #469

Closed
VSEphpbb opened this Issue Jan 15, 2013 · 19 comments

7 participants

@VSEphpbb

This plugin will break with jQuery 1.9 because the deprecated $.browser function is still being used, and it has been fully removed from the 1.9 release of jQuery.

TypeError: 'undefined' is not an object (evaluating 'g.browser.safari')

@jsor
Owner

This is true for version 0.2.8 but not for the upcoming 0.3.0 which no longer uses $.browser. If you want to use jCarousel 0.2.8 with jQuery 1.9.0 you have to use the jQuery migrate plugin.

@tkaw220

Looks like all the examples inside the functional folder (from master branch) is not working. Any idea?

@jsor
Owner

What exactly isn't working? Everything ok for me.

@tkaw220

All the vertical version seems working. But horizontal version break badly.

@jsor
Owner

What exactly breaks? Any output in the console?

@luyzgarcia

The consoles´s log shows only the following message:

"Uncaught TypeError: Cannot read property 'safari' of undefined jquery.jcarousel.min.js:16"

And the carousel buttons just do not work, you click and nothing happening.

@jsor
Owner

Looks like you mixed up the tests from 0.3.0 with the jCarousel source from 0.2.8.

@VSEphpbb

Looks like 0.3.0 is so different, it means I have to almost rebuild all the functions and styling from scratch just to get to where I am with 0.28...which is too much work for me right now.

instead, since $.browser seems to be the only issue in 0.2.8, and it is only used once to browser sniff for Safari, can it be updated with this:

instead of using this at line 194:

if (!windowLoaded && $.browser.safari) {

do something like this?:

if (!windowLoaded && /Safari/i.test(navigator.userAgent) && /Apple/i.test(navigator.vendor)) {
@rozwell

After 2h I finally realized it's jcarousel broken. Cloned and tried examples in functional tests. And like @tkaw220 mentioned, vertical worked, horizontal not. I had to add charset (which isn't there for some reason and FF didn't like that) - no errors in console, nothing.
Firefox 18.0 & Chromium 23.0.1271.97

@jsor
Owner

Here's the relvant code for $.browser: https://github.com/jquery/jquery/blob/1.8.3/src/deprecated.js#L9-L38
Simply include that for backward compatibility if you're using jQuery >= 1.9.0 and jCarousel 0.2.8.

@jhuon

jQuery 1.9 + jCarousel 0.3 don't work for me neither. The next and prev links just don't do anything. The same thing appears in the control examples, with the horizontal mode (the vertical one works fine).

@jsor
Owner

You have to resize your browser so that some of the items are hidden outside the carousel.

@jrsprice

Lately I feel like I'm taking 1 step forward and 2 steps back. jQuery 1.9, a minor version? really. I feel that every single plugin developer had to make updates. Seriously getting annoyed. Also jQuery has their recommendation for browser check, go see that plugin @ http://modernizr.com, it is partially developed by Paul Irish however how is this the solution? This new plugin seems bloated. It gets to the point where a website just has way to many js plugins where it becomes more and more frustrating to maintain. sigh

@VSEphpbb

@jrsprice

Modernizr is not for browser detection. It is for feature detection. It helps old browser cope with HTML5 tags and CSS3 that they don't natively support. It...modernizes...older browsers.

@jrsprice

@VSEphpbb

Don't be a troll. Where in my comment did I mention modernizr is used for browser detection? I already know this. I've been using it. If you go back to my original comment and read it you will see that I mentioned "jQuery has their recommendation for browser check" since $.browser was used to check browser. I was simply implying that jQuery had deprecated a useful feature such as $.browser and recommends using modernizr.

@jhuon

@jsor Thanks, that was not clear at first glance

@rozwell
@jsor
Owner

The functional tests aren't meant as examples, the flexible width is intentional. I still have to add real examples...

@tkaw220

Thanks @jsor for the clarification. The horizontal examples inside the test folder are working when resized browser to hide some items. Looking forward to stable release.

@jsor jsor closed this Feb 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment