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

Fix/#832 space in classnames #889

Closed
wants to merge 3 commits into from
Closed

Fix/#832 space in classnames #889

wants to merge 3 commits into from

Conversation

Matth10
Copy link

@Matth10 Matth10 commented Aug 12, 2020

Description

Fix for #832

This is the problem:

In some cases, we want to be able to pass multiple class names like so 'list first second'. However, this is making an error because classList.add doesn't support space.

Steps to reproduce:

When creating a Choices object, pass some custom classNames in the options.

new Choices(element, {
  itemSelectText: '',
  removeItemButton: true,
  classNames: {
    containerOuter: 'choices bg-gray-200 focus:bg-gray-100 focus:shadow shadow-inner appearance-none rounded w-full text-gray-700 leading-tight',
    containerInner: 'py-1 px-3',
    input: 'bg-gray-200 p-1',
  },
});

This is my solution:

It is possible to pass multiple classNames like so element.classList.add('first', 'second')

My solution is to let the user pass all the class names as a string with spaces. But internally it will generate an array and create an argument for each class name.

Types of changes

  • Chore (tooling change or documentation change)
  • Refactor (non-breaking change which maintains existing functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@Matth10 Matth10 mentioned this pull request Oct 1, 2020
8 tasks
@Matth10 Matth10 closed this Sep 22, 2021
@gaetan-hexadog gaetan-hexadog mentioned this pull request Nov 20, 2022
10 tasks
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

Successfully merging this pull request may close these issues.

1 participant