juice icon indicating copy to clipboard operation
juice copied to clipboard

Fix ignoredPseudos array

Open pkhodakovsky opened this issue 6 years ago • 3 comments

Fix ignoredPseudos array. If css contain selector like ".link-wrapper" juice ignored this selector and doesn't remove style tag. Use pseudos with colon, like ":link"

pkhodakovsky avatar Nov 19 '19 13:11 pkhodakovsky

@pkhodakovsky can you post some example code showing this or explain a little more? I'm not following.

jrit avatar Dec 17 '19 00:12 jrit

Hi It's still happening, here's the example;

Slightly modified file test/cases/juice-content/pseudo-selector-preserve.html:

<html>
<head>
    <style>
        a:hover {
            color: red;
        }
        a:active {
            color: red;
        }
        a:focus {
            color: red;
        }
        a:visited {
            color: red;
        }
        a:link {
            color: red;
        }
        a.my-link {
            background: green;
        }
    </style>
</head>
<body>
    <a class="my-link" href="#">hover me</a>
</body>
</html>

should produce test/cases/juice-content/pseudo-selector-preserve.out:

<html>
<head>
    <style>
a:hover {
  color: red;
}
a:active {
  color: red;
}
a:focus {
  color: red;
}
a:visited {
  color: red;
}
a:link {
  color: red;
}
</style>
</head>
<body>
    <a class="my-link" href="#" style="background: green;">hover me</a>
</body>
</html>

but it produces:

<html>
<head>
    <style>
a:hover {
  color: red;
}
a:active {
  color: red;
}
a:focus {
  color: red;
}
a:visited {
  color: red;
}
a:link {
  color: red;
}
a.my-link {
  background: green;
}
</style>
</head>
<body>
    <a class="my-link" href="#" style="background: green;">hover me</a>
</body>
</html>

Effectively preserving

a.my-link {
  background: green;
}

from being removed from the <style> tag.

antarasi avatar Nov 05 '20 23:11 antarasi