Bug Tracker

Modify

Ticket #2744 (closed bug: worksforme)

Opened 5 years ago

Last modified 5 years ago

Strange behaviour of .length on a li set

Reported by: Il Maestro Owned by: paul
Priority: major Milestone: 1.2.4
Component: ui Version: 1.2.3
Keywords: sortable length Cc:
Blocking: Blocked by:

Description

I'm trying to play with sortable, but i'm experiencing a strange thing on this  http://www.bamers.net/editor/editor4.htm. I have 3 <li> with class="layers" and a progressive id. If i call

var len = $("li.layers").length;

it gives len=4, while it should be 3. So if a use

$("li.layers").each(function(i){
 ......
});

it loops 4 times, and not 3.

I can't explain myself if it's an errore of mine or some sort of bug.

Change History

comment:1 Changed 5 years ago by scott.gonzal

  • Status changed from new to closed
  • Resolution set to worksforme

During the sort, there is a cloned helper that exists. You can filter this out by doing:

$('li.layers').not(ui.helper)

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.