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

null value in classList #71

Open
Csaba27 opened this issue Oct 7, 2023 · 1 comment
Open

null value in classList #71

Csaba27 opened this issue Oct 7, 2023 · 1 comment

Comments

@Csaba27
Copy link

Csaba27 commented Oct 7, 2023

Line 241 to 245

because of this, pushing null value to classList

var classList = [
  "option",
  option.attributes.selected ? "selected" : null,
  option.attributes.disabled ? "disabled" : null,
];

Fixes

var classList = ["option"];

if (option.attributes.selected) classList.push("selected")
if (option.attributes.disabled) classList.push("disabled")
@Csaba27
Copy link
Author

Csaba27 commented Oct 28, 2023

Unnecessary spaces in the classes list

Line 177

NiceSelect.prototype.renderDropdown = function() {
  var classes = [
    "nice-select",
    attr(this.el, "class") || "",
    this.disabled ? "disabled" : "",
    this.multiple ? "has-multiple" : ""
  ];

ex. ['nice-select', 'element-classlist', '', '']

Fixes

var classes = ["nice-select"];

if (attr(this.el, "class")) classes.push(attr(this.el, "class"))
if (this.disabled) classes.push("disabled")
if (this.multiple) classes.push("has-multiple")

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

1 participant