#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: |
Description
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)
Change History (7)
comment:1 Changed 14 years ago by
comment:3 Changed 13 years ago by
Component: | unfilled → core |
---|
comment:4 Changed 12 years ago by
Keywords: | needsreview added |
---|---|
Status: | new → open |
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
Resolution: | → worksforme |
---|---|
Status: | open → closed |
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
Keywords: | needsreview removed |
---|
Note: See
TracTickets for help on using
tickets.
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'.