Skip to main content

Search and Top Navigation

#2744 closed bug (worksforme)

Opened April 25, 2008 08:13AM UTC

Closed April 25, 2008 11:22AM UTC

Last modified May 24, 2008 03:39AM UTC

Strange behaviour of .length on a li set

Reported by: Il Maestro Owned by: paul
Priority: major Milestone:
Component: ui.core Version: 1.2.3
Keywords: sortable length Cc:
Blocked by: Blocking:
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.

Attachments (0)
Change History (2)

Changed April 25, 2008 11:22AM UTC by scottgonzalez comment:1

resolution: → worksforme
status: newclosed

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

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

Changed May 24, 2008 03:39AM UTC by comment:2

milestone: 1.2.4

Milestone 1.2.4 deleted