Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated measureString to return 0 for an empty string. #243

Merged
merged 1 commit into from
Feb 10, 2014
Merged

Updated measureString to return 0 for an empty string. #243

merged 1 commit into from
Feb 10, 2014

Conversation

enoshixi
Copy link
Contributor

@enoshixi enoshixi commented Jan 9, 2014

My app was using a lot (100+) of selectize controls on a page and autoGrow / measureString was a significant bottleneck.

An easy fix was to have measureString avoid actually measuring when not necessary (i.e. empty string).

I also keep track of the current width of the input in the autoGrow closure to avoid having to measure the width before updating it, as that was also slowing down initialization.

In autoGrow, track the input's current width in a closure rather than
using jQuery .width() to see if the width needs updating.
brianreavis added a commit that referenced this pull request Feb 10, 2014
Updated measureString to return 0 for an empty string.
@brianreavis brianreavis merged commit 67ef826 into selectize:master Feb 10, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants