fix: ellide inline css custom properties

* ellide css custom properties when converting css inline styles to map

  Signed-off-by: Lim Jia Sheng <50891910+sxxov@users.noreply.github.com>
This commit is contained in:
jiaSheng 2024-08-07 13:13:02 +08:00 committed by Philip Molares
parent a55eac74fc
commit 82e7f439c8

View file

@ -61,7 +61,9 @@ export function convertInlineStyleToMap(
// additionally don't uppercase any -ms- prefix // additionally don't uppercase any -ms- prefix
// e.g. -ms-style-property = msStyleProperty // e.g. -ms-style-property = msStyleProperty
// -webkit-style-property = WebkitStyleProperty // -webkit-style-property = WebkitStyleProperty
const replacedProperty = property const replacedProperty = property.startsWith('--')
? property
: property
.toLowerCase() .toLowerCase()
.replace(/^-ms-/, 'ms-') .replace(/^-ms-/, 'ms-')
.replace(/-(.)/g, (_, character: string) => character.toUpperCase()) .replace(/-(.)/g, (_, character: string) => character.toUpperCase())