Skip to content

Make option icons optional to improve performance. #207

@wbobeirne

Description

@wbobeirne

Hey Greg, huge fan of the plugin, gave me exactly what I needed for a custom select box.

However, I ran in to performance issues pretty quickly. I've got a fairly complicated form with ~30 selects, and the plugin was locking my page up for ~1.7s. Obviously part of the problem is a page with 30 select boxes, but might as well improve performance where possible. After some profiling, I found that width measurements are the most expensive operations performed. Disabling autoWidth helped some, but the most expensive thing was the option icons (http://gregfranko.com/jquery.selectBoxIt.js/index.html#IconsandImages)

The following block of code: https://github.com/gfranko/jquery.selectBoxIt.js/blob/master/src/javascripts/jquery.selectBoxIt.js#L668-L674 is incredibly expensive, so instead of assuming it'll use an image, and then removing if it doesn't, this should be a parameter (i.e. noIcons: true)

I can do a pull request for this in a while, but I wanted your opinion on this before I put the work in. In the mean time for my case, I've just cut out all of the code relevant to dropdownImageContainer.

Thanks!

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions