Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class definitions not created on outer div #731

Open
dirkbez opened this issue Nov 24, 2020 · 4 comments
Open

Class definitions not created on outer div #731

dirkbez opened this issue Nov 24, 2020 · 4 comments

Comments

@dirkbez
Copy link

dirkbez commented Nov 24, 2020

for version 3.3.5
The class assignments on the outer div do not work. The classes are "bootstrap-switch-undefined bootstrap-switch-undefined bootstrap-switch-undefined bootstrap-switch-undefined bootstrap-switch-undefined bootstrap-switch bootstrap-switch-wrapper bootstrap-switch-animate"
It, therefore, does not honour the size assignment.

On inspection v.3.3.4 (as used by the Codepen) does seem to assign the classes correctly

@it4joy
Copy link

it4joy commented Jun 27, 2022

I have the same problem with incorrect classes for wrapper, Bootstrap Switch, version v3.3.4. Very strange, I don't understand what caused it...

@ZHLHLTL
Copy link

ZHLHLTL commented Jun 27, 2022 via email

@fmarchalemisys
Copy link

Same problem exists in v3.4.0.

It is caused by

].filter(v => v == null);

The filter is wrong. I believe it should be

return [
    state ? 'on' : 'off',
    size,
    disabled ? 'disabled' : undefined,
    readonly ? 'readonly' : undefined,
    indeterminate ? 'indeterminate' : undefined,
    inverse ? 'inverse' : undefined,
    id ? `id-${id}` : undefined,
  ].filter(v => v != null);

or, to be more coherent with the values in the array:

return [
    state ? 'on' : 'off',
    size,
    disabled ? 'disabled' : undefined,
    readonly ? 'readonly' : undefined,
    indeterminate ? 'indeterminate' : undefined,
    inverse ? 'inverse' : undefined,
    id ? `id-${id}` : undefined,
  ].filter(v => v != undefined);

But you certainly don't want to apply a filter to keep undefined values.

@ZHLHLTL
Copy link

ZHLHLTL commented Dec 8, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants