ghiscoding / Aurelia-Bootstrap-Plugins

Aurelia-Bootstrap-Plugins are Custom Elements to bridge with a set of 3rd party Bootstrap addons
https://ghiscoding.github.io/Aurelia-Bootstrap-Plugins
MIT License
45 stars 23 forks source link

Update abp-select.js #23

Closed amayr666 closed 7 years ago

amayr666 commented 7 years ago

fixed #22, should not change any behavior of current implementations with multiple=false

ghiscoding commented 7 years ago

I tried your code locally and it actually won't work (as is) because there's also some code to change in the View of the customElement. Specifically, I have a parseBool() on the multiple.bind, and for your change to work, we have to assume that the result of the parseBool is True on empty. So I updated the code to be multiple.bind="util.parseBoolOrTrueOnEmpty(multiple) & optional" and added this new util.parseBoolOrTrueOnEmpty() function and it works.

I basically wanted to cover the following 4 cases:

1- only multiple <select multiple /> 2- with multiple true <select multiple="true" /> 3- with multiple false <select multiple="false" /> 4- incorrect attribute will default to False <select multiple="foo" />

So I will merge your code and add my changes as well to make it all work. Expect a new version coming soon.

amayr666 commented 7 years ago

Great Job, thanks! Now it's supporting html5 standard when it comes to the multiple flag. We're really looking forward to this change ;)