Skip to content

Fix Data Attributes Selectors #12

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

Merged
merged 3 commits into from
May 18, 2023

Conversation

Publicker
Copy link
Contributor

This pull request addresses an issue (#11) where data attributes were not functioning as expected.

The selectors for data attributes have been fixed and now operate correctly. This has been tested with TailwindCSS data attributes, and the functionality has been confirmed.

Please review these changes to ensure that the data attributes are now functioning as intended.

@n4j1Br4ch1D
Copy link
Owner

n4j1Br4ch1D commented May 18, 2023

Hi @Publicker thanks for PR, I have been taking some time to look at the new features in tailwinds, and found some CSS classes that don't obfuscate for many reasons but mainly due to: the regex used to parse CSS selectors.
some example:

 {/* Solved */}
      {/* only removes  CSS [attribute*=value] selectors when the `[` is not preceded by `-\`. 
       thus it avoids tailwind`s arbitrary values, & data attributes */}
      {/* 
        .totest[href="value"] {
           ...
        }
     */}
      <span class="totest">1</span> 
      <span class="pt-[100px]">2</span>
      
      <span class="data-[size=large]:p-8">3</span>
      <span class="data-[href='active']:bg-green-100">4</span>
      <span class="data-[size=large]:p-8">5</span>
      <span class="group-data-[status='active']:text-green-700">6</span>

{/* Not yet solved */}

      {/* problem with parsing . as a new class */}
      <span class="group-[.is-published]:block">8</span>
      <span class="peer-[.is-dirty]:peer-required:block">10</span>
     
      {/* prblm with (*) beign removed */}
      <span class="group-[:nth-of-type(3)_&]:block">9</span>
      <span class="[@supports(display:grid)]:grid">7</span>
      <span class="[@media(any-hover:hover){&:hover}]:opacity-100">12</span>

As per your commits unfortunately your solution only works for your situation & won't work for CSS [attribute*=value]. .totest as an example above.

So ill make a commit for you in a minute to test my new solution, and ill open issue/issues for the rest not yet solved
13 Tailwindcss Advanced Classes: 1-parentheses removed for @supports, @media, nth-of-type, ...-->Solved Now,
14 Tailwindcss Advanced Classes: 1-classes used as arbitrary values --> Not yet solved.

@n4j1Br4ch1D
Copy link
Owner

@Publicker plz check the solution : a71e8b7
before i merge

@n4j1Br4ch1D n4j1Br4ch1D self-assigned this May 18, 2023
@n4j1Br4ch1D n4j1Br4ch1D self-requested a review May 18, 2023 15:43
@n4j1Br4ch1D n4j1Br4ch1D added bug Something isn't working enhancement New feature or request labels May 18, 2023
@n4j1Br4ch1D n4j1Br4ch1D linked an issue May 18, 2023 that may be closed by this pull request
@Publicker
Copy link
Contributor Author

Publicker commented May 18, 2023

@Publicker plz check the solution : a71e8b7 before i merge

@n4j1Br4ch1D Thanks for the explanation. I just tested the solution in the mentioned commit and seems to be working for data attributes 👍🏻.

@n4j1Br4ch1D
Copy link
Owner

@Publicker plz check the solution : a71e8b7 before i merge

@n4j1Br4ch1D Thanks for the explanation. I just tested the solution in the mentioned commit and seems to be working for data attributes 👍🏻.

@Publicker glad it does: only #14 is left it will be solved soon, and all fixes will be released on the next version soon.
Plz, consider giving the project a start to keep it going.

@n4j1Br4ch1D n4j1Br4ch1D merged commit 513d2ec into n4j1Br4ch1D:main May 18, 2023
@Publicker
Copy link
Contributor Author

@Publicker plz check the solution : a71e8b7 before i merge

@n4j1Br4ch1D Thanks for the explanation. I just tested the solution in the mentioned commit and seems to be working for data attributes 👍🏻.

@Publicker glad it does: only #14 is left it will be solved soon, and all fixes will be released on the next version soon. Plz, consider giving the project a start to keep it going.

@n4j1Br4ch1D I'm sure that will be ready sooner than I expect! Keep the good work going!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TailwindCSS Data Attributes
2 participants