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 ez-toc-container class to container #127

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tyrann0us
Copy link
Contributor

@tyrann0us tyrann0us commented Feb 12, 2021

Currently, the container does not include a base HTML class.
So if you want to apply styles to all ToC elements regardless of their configuration, you either have to use the #ez-toc-container id (which some might consider bad practice) or use an unnecessarily inconvenient attribute selector ([class^="ez-toc-v"]). Of course, you could use the ez_toc_container_class filter to add the class yourself, but you'd need to do this on every project you use the plugin in.

By adding a generic .ez-toc-container class, none of the "workarounds" would be necessary.

Currently, the container does not include a base HTML class.
So if you want to apply styles to all ToC elements regardless of their configuration, you either have to use the `#ez-toc-container` id (which some might consider bad practice) or use an unnecessarily inconvenient attribute selector (`[class^="ez-toc-"]`). Of course, you could use the `ez_toc_container_class` filter to add it, but you'd need to do this on every project you use the plugin in.

By adding a generic `.ez-toc-container` class, none of the "workarounds" would be necessary.
@shazahm1
Copy link
Contributor

A single TOC is on a page, why would not using its id selector not be a good practice?

@tyrann0us
Copy link
Contributor Author

Hi @shazahm1, thanks for getting back to me.

A single TOC is on a page, why would not using its id selector not be a good practice?

IMHO, when working with an element that has variation, there should always be a "base" class in addition to the classes that describe the variation. Kind of like how BEM works.

I'd really appreciate it if you could accept the PR. Thanks!

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.

2 participants