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

Apply select2('option') calls on all elements #3495

Closed
wants to merge 1 commit into from

Conversation

pquentin
Copy link
Contributor

Fixes #3413

The idea of the patch is simple: as with 'object' options, we iterate over this.

I don't know how to test destroy(), so... I did not test it. I might give it a try with some guidance. Should dist/ changes be part of the pull request? This is not mentioned in CONTRIBUTING.md.

@pquentin
Copy link
Contributor Author

The tests pass, but I could have broken another string option. However, 'destroy' seems to be the only documented one. If this is indeed the only option in 4.0, then thisMethods should go away.

(This is a 4.0 pull request.)

@kevin-brown
Copy link
Member

However, 'destroy' seems to be the only documented one.

select2('open'), select2('close'), and select2('destroy') are officially supported and documented.

select2('val') (deprecated) and select2('data') (partially deprecated) are also on the list, but those are not documented. Interestingly, they are partially tested.

@pquentin
Copy link
Contributor Author

Thank you @kevin-brown for your answer! However, I'm not going to work on a fixed version of this pull request. I actually changed the way I use select2 to not use 'destroy'. I hope I still helped the project a little bit.

tzellman pushed a commit to tzellman/select2 that referenced this pull request Feb 2, 2016
This fixes an issue when any of Select2's special options are called on
multiple elements, it would only affect the first option in the group.
This was because Select2 was only applying any changes to the first
element in the group (as chosen by jQuery) instead of applying changes
on each and every element within the list.

This has the new side effect of special options like `select2('data')`
returning the results for the last element in the list instead of the
first element. Because the previous functionality was considered
unspecified behaviour, this is not being treated as a breaking change.

This closes select2#3413
This closes select2#3495
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