Selectr
Selectr copied to clipboard
Plugin started while including (with missing DOM arg), before call
Reproducing Steps:
- npm install mobius1-selectr --save
- require("mobius1-selectr")
(!) Here I got next one:
selectr.js:922 Uncaught Error: You must supply either a HTMLSelectElement or a CSS3 selector string.
at Object.m (selectr.js:922)
at s.defaultSelected (selectr.js:11)
at Object.
- new Selectr(document.getElementById('taggable'));
If I understood right - plugin run on step#2 (require ...), not step#3 (new Selectr...), but why? Explain or Fix, please.. thx.
Wow, i searched for hours because of this, and it was on here all along.
Yeah the method for calling this library doesn't seem ordinary
This is progress to be rectified in the next major version.
Found a solution yesterday, can be overridden with:
const Selectr = require("imports-loader?this=>window,define=>false!mobius1-selectr/src/selectr.js");
Needs imports-loader.
I've not has much free time to look at this, but if anyone wants to submit a pull request with a fix, I'll be happy to merge it.