ericcornelissen/webmangler

CssLanguagePlugin does not mangle classes in attribute selectors

Closed this issue · 0 comments

Bug Report

Description

The CssLanguagePlugin won't mangle CSS classes in attribute selectors (e.g. [class="cls-foo cls-bar"]). This is because it's missing support for the multi-value-attributes expression type. As such, this bug applies more generally to any plugin that relies on the multi-value-attributes expression type.

Actual Behaviour

  1. Have a CSS with a attribute selector for the class attribute. For example:

     .cls-foo {
       color: red;
     }
     [class="cls-foo"] {
       color: purple;
     }
  2. Run WebMangler CLI (version 0.1.6) with WebMangler Core (version 0.1.24) and at least WebMangler CSS Language Plugin version 0.1.27 and WebMangler CSS Class Mangler version 0.1.23.

  3. Observe that the CSS file isn't mangled completely. For the example above:

     .a {
       color: red;
     }
     [class="cls-foo"] {
       color: purple;
     }

Expected Behaviour

The mangled CSS looks something like:

.a {
  color: red;
}
[class="a"] {
  color: purple;
}