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

Add option to avoid duplicating the original class attribute #344

Open
jcam5826 opened this issue Oct 20, 2022 · 1 comment
Open

Add option to avoid duplicating the original class attribute #344

jcam5826 opened this issue Oct 20, 2022 · 1 comment

Comments

@jcam5826
Copy link

I upgraded my version of SumoSelect from version 3.0.3 to 3.4.8. There was a change made way back on 6/17/21 -- "feat: Pass origin class to generated element. Fixes [#294]". Which copies the class from the original select element to the ".CaptionCont.SelectBox" div element. This causes a problem on my legacy code which I have to remedy by undoing the duplicate classes:

const $select = $(".foo").SumoSelect();
$select.parent().find(".CaptionCont").removeClass($select.attr("class"));

It would be nice if an option existed that would prevent this duplication of classes.

I think the original issue #294, was simply requesting that an argument can be passed in to define what extra classes should be added to the generated element -- not necessarily forcing the parent's class to be duplicated. Maybe you can revisit the original request and if a class name is actually passed in, it would use the class name INSTEAD of duplicating the class name of the original select element. The duplication is unexpected and would be easy for someone who later selects elements based on only a class name, $(".foo)" to end up being surprised that they also picked up the ".CaptionCont" div -- granted a more specific selection of $("select.foo") would have been more prudent.

@Zenoo
Copy link
Collaborator

Zenoo commented Oct 20, 2022

A way to solve this would be to cancel the class duplication and add an option to add classes to individual sumoselect components.

I don't have the bandwidth to handle it right now, but I will get around to it at some point.

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

No branches or pull requests

2 participants