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

jQuery version detection is broken #63

Closed
codener opened this issue May 3, 2018 · 2 comments
Closed

jQuery version detection is broken #63

codener opened this issue May 3, 2018 · 2 comments

Comments

@codener
Copy link

codener commented May 3, 2018

First: Thanks for the SudoSlider. We're using it for years and are quite happy with it.


I was wondering why SudoSlider would refuse to use CSS for transitions. When I dug into the code, I found that SudoSlider set usecss to false because it believed the jQuery version was too low.

https://github.com/webbiesdk/SudoSlider/blob/33253a1ea51af256021ba81ddb4c4831369c1552/js/jquery.sudoSlider.js#L74-L76

Unfortunately, the minJQueryVersion function is lying. It will only return true if all digits are greater than the required minimum, which is wrong when it comes to versions numbers.

https://github.com/webbiesdk/SudoSlider/blob/33253a1ea51af256021ba81ddb4c4831369c1552/js/jquery.sudoSlider.js#L2899-L2909

Instead, the function should return early as soon as any digit is greater than required:

    // The minVersion is specified in an array, like [1, 8, 0] for 1.8.0
    function minJQueryVersion(minVersion) {
        var version = $.fn.jquery.split(".");
        var length = version.length
        for (var i = 0; i < length; i++) {
            if (+version[i] < +minVersion[i]) { return FALSE; }
            if (+version[i] > +minVersion[i]) { return TRUE; }
        }
        return TRUE;
    }

Best regards

@webbiesdk
Copy link
Collaborator

Nicely spotted 👍

@codener
Copy link
Author

codener commented May 3, 2018

Ok THIS was fast 😄
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants