On https://drafts.csswg.org/cssom/#serialize-a-css-declaration the property name string is appended directly onto the final string, but this behavior would break the redefinition of the same style with e.style = e.style.cssText when there are custom properties with special characters.
This is demonstrated by the WPT test: https://wpt.fyi/results/css/cssom/variable-names.html, from which the current specified behavior seems to disagree.
Should we maybe apply the algorithm from https://www.w3.org/TR/cssom-1/#serialize-an-identifier to the property name?