Invalid JavaScript minification of string literals
-
The Autoptimize JavaScript minification process incorrectly transforms string literals inside JavaScript code, breaking expected runtime behavior. In particular, string arguments passed to functions are modified during minification, resulting in invalid logic and runtime errors in the browser.
Original code (before minification):
let r=()=>.${(t.params.wrapperClass||).trim().split().join(.)}Minified / transformed code (after Autoptimize):
let r=()=>.${(t.params.wrapperClass||).trim().split().join(.)}Issue
The minifier incorrectly transforms:
.split()into:
.split()This changes the logic from splitting a class string by spaces into splitting it into individual characters.
Impact
This leads to invalid CSS class selectors such as:
.s.w.i.p.e.r.-.w.r.a.p.p.e.rwhich causes runtime errors like:
Failed to execute 'matches' on 'Element': '.s.w.i.p.e.r.-.w.r.a.p.p.e.r' is not a valid selector
You must be logged in to reply to this topic.