jQuery-Selectric icon indicating copy to clipboard operation
jQuery-Selectric copied to clipboard

Namespace all selectors and styles using BEM conventions

Open SethTompkins opened this issue 8 years ago • 6 comments

I have been using your awesome library recently and have run into some issues with how the selectors architected. Classes like .button can cause a mess when you also have a standard .button component in your style sheet.

I propose to namespace all selectors for this library appropriately using BEM conventions. The root element should be .selectric and all other elements as .selectric__element-name. This would also require changes to the stylesheet.

Would you be interested in this contribution? I would be happy to take the time to put together a PR if it would be considered.

SethTompkins avatar Mar 15 '17 17:03 SethTompkins

Yes! I'm really interested in that.

I haven't done this myself yet because I don't have time at the moment.

We have to be a little careful though, since there's legacy options to switch classes cases. Take a look at jquery.selectric.js for example. I don't know what the behaviour would be in this case. Maybe remove this functionality all together?

lcdsantos avatar Mar 15 '17 20:03 lcdsantos

Yea, this would be a backwards-incompatible change, requiring a major version # bump.

It looks like most of the selectors are covered using the prefix option, however even if you use that option .button, .label, .selected, and .last are hardcoded classnames that float in the global namespace.

I would recommend removing that functionality, I don't think it is integral to this lib.

SethTompkins avatar Mar 15 '17 20:03 SethTompkins

All for this. I'm about to implement this on a project - are these revisions underway? Odds of being completed in a few days? If not no big deal, just would like to not do it twice because I missed it by a day or two ha!

jeffreyscottfrench avatar Mar 21 '17 18:03 jeffreyscottfrench

I have not started on this, I was waiting to hear back on whether breaking backwards compat was a no no...

SethTompkins avatar Mar 21 '17 18:03 SethTompkins

Ah ok - thanks for the info!

jeffreyscottfrench avatar Mar 21 '17 20:03 jeffreyscottfrench

We ship it on v2.

It's ok to not be backwards compatible.

lcdsantos avatar Mar 21 '17 23:03 lcdsantos