Skip to main content

Search and Top Navigation

#14896 closed bug (worksforme)

Opened January 06, 2016 06:51PM UTC

Closed January 13, 2016 04:04PM UTC

Sortable cancel method not working with :not selector

Reported by: tilwinjoy Owned by:
Priority: major Milestone: none
Component: ui.sortable Version: 1.11.4
Keywords: sortable cancel :not selector Cc:
Blocked by: Blocking:
Description

Sortables cancel option[https://api.jqueryui.com/sortable/#option-cancel] is not working with

:not() selector https://api.jquery.com/not-selector/

Here's a small fiddle http://jsfiddle.net/tilwinjoy/PG66Z/28/ demonstrating the problem.

The selector used is ':not(.valid)' Expected result is that the last <li> alone should not be draggable, since it doesn't have the 'valid' class. But none of the elements are draggable, even the ones having class 'valid'

Attachments (0)
Change History (1)

Changed January 13, 2016 04:04PM UTC by scottgonzalez comment:1

resolution: → worksforme
status: newclosed

That's because the cancel option defines a selector which is run against the element using .closest(). All of the items in your sortable are contained in an element that match your selector. What you want to use is something like ".sortable-item:not(.valid)".