Merge CSS rules happens before remove unused rules

Bug #1910903 reported by Phssthpok
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

In the "Remove unused CSS" dialog, if "Remove unused class attributes" and "Merge CSS rules with identical properties" are both checked, the identical rules are merged before removal, even if some of the merged rules are unused. For example, given the following rules, where class "first" is used but class "second" is not:

    .first {
      font-size: 2em;
    .second {
      font-size: 2em;

the rules are merged to give:

    .first, .second {
      font-size: 2em;

and class "second" is then not removed, even though it is not used.

Doing the merge after the removal would fix this issue.

The perfect solution would be to remove class "second", even when it occurs in a merged rule; at present, compound rules like

    h1, h2, h3, h4, h5, h6 {
      text-align: center;

will leave all six heading tags in the rule, even if only h1 and h2 are present in the text. it would be better if "Remove unused class attributes" reduced this to

    h1, h2 {
      text-align: center;

Version info: Calibre 5.8.1, Windows 10 64-bit.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.