Mobius1/Selectr

width option not working

Opened this issue · 3 comments

I don't know much about English, so I'm sorry.

build() method that changes the width of the code does not work.

Fix:
Replace :
if (isset(this.config, "width"))

To:
if (typeof this.config.width !== 'undefined')

thanks for that,
it's work for me (and before not).

Yes, thanks so much for this suggested change. Without it, width option doesn't apply for me when used like:

var newSelectr = new Selectr('#some-id', {
searchable: false,
width: 190
});

The problem is still there in production version (minified).
If you use:
width: 190
then, "isset" call from line 331 (patched by @1grafik as a solution ) returns false because condition
(obj[prop] === true || obj[prop].length) is evaluated as false since first part is false and second part is undefined
If you use:
width: "190"
"isset" call from line 331 returns true but "util.isInt" call returns false since first condition:
typeof val === 'number' is false (obviosly)