jcu-eresearch / matrix-helpers

100% Unguessable™. Public bug tracker, pages, designs and helpers that make life in Squiz Matrix easier. The metaphorical red pill.
https://jcu-eresearch.github.io/matrix-helpers/
GNU Affero General Public License v3.0
3 stars 0 forks source link

CSS "Basic Minifier" (cssmin.php) breaks rules with attribute selectors #92

Open davidjb opened 7 years ago

davidjb commented 7 years ago

Trying to use a CSS File Folder in Matrix with a CSS file with the following rule (a valid, a CSS attribute selector):

.bg--cover[style*="background-attachment: fixed;"] {
  background-attachment: scroll !important;
}

turns the above rule into the following:

.bg--cover[style*="background-attachment:fixed;"] {background-attachment: scroll !important;}

This has one subtle, but breaking change -- the removal of the whitespace inside the attribute selector. This causes the selector break as CSS requires the (sub)string be literally matched. Because the intended DOM element has a style attribute of background-attachment: fixed, the 'minified' selector no longer matches.

A workaround could be to change the source to match what the minifier is producing, but the core issue here is that minifier produces inconsistent output. For now, switching back to merging-only on the CSS File Folder works.

Tested with Matrix 5.4.0.3

davidjb commented 7 years ago

Reported at https://squizmap.squiz.net/matrix/10785

davidjb commented 7 years ago

Apparently fixed and released at part of 5.4.2. Awaiting an upgrade, if we can ever get it.