Mobius1 / Selectr

A lightweight, vanilla javascript select box replacement. No dependencies.
MIT License
313 stars 77 forks source link

Prevent deleting optgroups on open() in mobile viewport #136

Closed trailsnail closed 4 years ago

trailsnail commented 5 years ago

This PR should fix https://github.com/Mobius1/Selectr/issues/91 But I'm not sure, if the code around is still relevant. I tried some testcases with config.data and native options in select as initial markup and all seems to work.

Question

if (this.config.data) {  
    // Dump the options into the select
    // otherwise the native dropdown will be empty
    util.each(this.options, function(i, option) {
        this.el.add(option);
    }, this);
}