Support » Plugin: Swift Performance Lite » Spaces before class names in HTML invalidate CSS selector

  • Resolved thomaswest


    I think I’ve found a bug in the way Swift handles CSS in (I think) the critical CSS functionality. Swift adds classes to html elements (such as _a1, _7g, etc). However, in front of the ‘regular’ classes swift adds a space. Thus, the code is changed from <div class="button-class"> to <div class=" button-class _a1 "> (notice the extra spaces around the classes. This invalidates a specific CSS selector, namely [class^="button-class"], which selects elements with class names that start with the string ‘button-class’ and not ‘ button-class’. It has created some elements not to show up after using swift. I’m using Swift Performance Lite version 2.0.10.

    • This topic was modified 11 months, 3 weeks ago by thomaswest.
Viewing 1 replies (of 1 total)
  • Plugin Contributor Fred


    Thank you for reporting this, we will check it. As a quick fix you can disable Compress Critical CSS option.

Viewing 1 replies (of 1 total)
  • The topic ‘Spaces before class names in HTML invalidate CSS selector’ is closed to new replies.