Skip to content

Striped table rows cleancss fix #663

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Yohn
Copy link

@Yohn Yohn commented Mar 15, 2025

Its a little dirty, but it works. CleanCSS was causing the issue, and we can tell it to not modify that code block. I tried it a few different ways before I settings with this.

Its a little dirty, but it works. CleanCSS was causing the issue, and we can tell it to not modify that code block.
I tried it a few different ways before I settings with this.
@lucaslarroche
Copy link
Member

lucaslarroche commented Mar 16, 2025

@Yohn, great find, you are right, it's the minifier.

I did more tests and actually we could do this:

tbody {
  // Striped rows skip hidden elements (`odd of :not([hidden])`), `:is()` prevents minifier issues.
  tr:is(:nth-child(odd of :not([hidden]))) {
    th,
    td {
      background-color: var(#{$css-var-prefix}table-row-stripped-background-color);
    }
  }
}

What do you think?

@Yohn
Copy link
Author

Yohn commented Mar 16, 2025

Nice find! Idk why I didn't think to try is() when I was messing with that. I'll modify this pull request for that change.

use `:is()`
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