Fixed JavaScript switch response regex quirk

Lukas W.

Well-known member
Affected version
2.0.6
The regex for the switch response is a bit quirky.

The regex /^(\s*,)?\s*(addClass|removeClass):([^,]+),/ (found in js/xf/core/action.js:237) does not match the (imo) correct attribute data-sk-watch="addClass:fa-eye,removeClass:fa-eye-slash", but does match the (again imo) incorrect data-sk-watch="addClass:fa-eye,removeClass:fa-eye-slash," attribute.

Suggested fix:
/(\s*,)?\s*(addClass|removeClass):([^,]+)(,|$)/
 
Top Bottom