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

Bug #525 - optimise rendering of select options. #528

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

glenpike
Copy link
Collaborator

@glenpike glenpike commented Oct 3, 2016

As per fix, push each rendered element into an array which we
then pass to $.fn.add in one go - more efficient.
Add test to ensure that add only gets called once.

As per fix, push each rendered element into an array which we
then pass to $.fn.add in one go - more efficient.
Add test to ensure that add only gets called once.
@midnightcodr
Copy link

This fix works great. Hope the pull request got approved soon.

@@ -221,18 +221,18 @@ Form.editors.Select = Form.editors.Base.extend({
var optgroup = $("<optgroup>")
.attr("label",option.group)
.html( this._getOptionsHtml(option.options) );
html = html.add(optgroup);
html[html.length] = optgroup[0];
Copy link
Collaborator

@philfreo philfreo Oct 17, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not say html.push(optgroup[0])?

For adding to array, use '[].push' instead of '[arr.length] ='
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.

3 participants