bluzky/nice-select2

extractData when page is reloaded

lhapaipai opened this issue · 1 comments

Hi !
Thanks for your nice select !
I can suggest you to use the javascript properties instead of html attributes in your extractData method.
If you refresh your page and you have selected some options in your select form. your options are not coded in the html attributes but are clearly visible to the user and accessible with javascript.

file : src/js/nice-select2.js#L119

    var attributes = {
-      selected: item.getAttribute("selected") != null,
+      selected: item.selected,
-      disabled: item.getAttribute("disabled") != null,
+      disabled: item.disabled,
       optgroup: item.tagName == 'OPTGROUP'
    };

fixed