rniemeyer / knockout-sortable

A Knockout.js binding to connect observableArrays with jQuery UI sortable functionality
MIT License
548 stars 128 forks source link

hasNestedSortableFix check not working for versions past 1.8.24 #174

Open imahassle opened 7 years ago

imahassle commented 7 years ago

I am using jQuery UI version 1.10.1, which definitely has the nested sortable fix added in 1.8.24.

However, the logic determining hasNestedSortableFix evaluates to -1, which later evaluates to false (used as !hasNestedSortableFix), since !-1 is false.

hasNestedSortableFix = version && version.indexOf("1.6.") && version.indexOf("1.7.") && (version.indexOf("1.8.") || version === "1.8.24");

As a result, I am encountering some pretty funky behavior (extra elements being added to the dom, other elements being cloned and replaced and removed after an unrelated action), and my observable data model not being updated. Setting the hasNestedSortableFix to false fixes this, since later this is negated to true.

I would request a fix in the version checking logic to allow for higher versions of jQuery UI which have the fix.