Fix addOption when 'nested' specified #251

Merged
merged 2 commits into from Nov 22, 2016

Projects

None yet

2 participants

@solidmoose
Contributor

Fixed an issue where addOption would not find the proper place to insert into when optgroups are specified & index is not.
Example here: https://jsfiddle.net/me8v1fyp/

The index calculation doesn't recognize that that.$element.children() is the list of optgroups when they are specified, so it places the new option after the last optgroup - instead of entering the specified group (nested) to insert into.

solidmoose added some commits Sep 18, 2016
@solidmoose solidmoose Fix addOption when 'nested' specified b5e268a
@solidmoose solidmoose Fix addOption when 'nested' specified
Tidied up code (realized the logic was already there, just out of order).
4083c0e
@solidmoose
Contributor

Cleaned it up -- as it turns out, all that had to be done was initialize $container first, and use it to find the index in place of that.$element.

@lou lou merged commit e052211 into lou:master Nov 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment