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

Used css attribute selector gets removed by critters #147

Open
michael-hein opened this issue Nov 21, 2023 · 0 comments
Open

Used css attribute selector gets removed by critters #147

michael-hein opened this issue Nov 21, 2023 · 0 comments

Comments

@michael-hein
Copy link

When using the Critter with a css selector attribute contains or attribute starts with, then the Critter removes this selector even if its used.

 const critters = new Critters({
    // optional configuration (see below)
  });

  const html = `
    <style>
      .red { color: red }
      .blue { color: blue }
      [class*=' test-'] {background-color: green}
    </style>
    <html>
    <body>
    <div class="blue test-green">I'm Blue</div>
    </body>
    </html>
  `;

  const inlined = await critters.process(html);

  console.log(inlined);

this results to

Inlined 17 B (15% of original 109 B) of inline CSS.
Time 10.45

    <style>.blue{color:blue}</style>
    <html data-critters-container>
    <body>
    <div class="blue test-green">I'm Blue</div>
    </body>
    </html>

but the expectation is that [class*=' test-'] {background-color: green} should be still present.

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

No branches or pull requests

1 participant