Bug Tracker

Opened 14 years ago

Closed 12 years ago

Last modified 12 years ago

#4407 closed enhancement (worksforme)

Empty selectbox

Reported by: Jorik Owned by:
Priority: major Milestone: 1.3.2
Component: core Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:


The empty() method on a selectbox is _much_ slower then selectbox.options.length = 0; Maybe it is nice to check if the element is a selectbox, and then use the options.length way to empty the selectbox.

Attachments (1)

Untitled-1.html (1.9 KB) - added by jerone 14 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 14 years ago by jerone

I tested whats faster; the build-in jQuery technick of a while loop and your suggestion of length=0 Aldo your suggestion is faster then the while loop, it's not the while loop that slows it down; it's the expando management that is the 'problem'.

Changed 14 years ago by jerone

Attachment: Untitled-1.html added


comment:2 Changed 14 years ago by jerone

My test results in FF:

  • test1: 73ms
  • test2: 1ms
  • test3: 4ms

comment:3 Changed 13 years ago by dmethvin

Component: unfilledcore

comment:4 Changed 12 years ago by dmethvin

Keywords: needsreview added
Status: newopen

We still need to clean off the data attributes. I can't get the test case to work though.

comment:5 Changed 12 years ago by dmethvin

Resolution: worksforme
Status: openclosed

The differences don't seem that large to me; I even increased the number of options. For cases where someone is updating large numbers selects at a high frequency and is willing to risk the memory leaks, they can set options.length=0.


comment:6 Changed 12 years ago by dmethvin

Keywords: needsreview removed
Note: See TracTickets for help on using tickets.