preact-compat
preact-compat copied to clipboard
textLength should not be kebap-cased
textLenght
is a valid attribute on svg:tspan
and svg:text
: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/textLength
Unfortunately, textLength
gets kebap-cased to text-length
because it matches the CAMEL_PROPS regex.
Comparing with the SVG attribute reference, the following attributes are likely affected:
-
clipPathUnits
-
glyphRef
-
markerHeight
,markerUnit
,markerWidth
-
textLength
-
xChannelSelector
Can confirm, clipPathUnits gets rendered as clip-pathunits.
Hmm - it looks like the regex that is handling clipPathUnits
is missing /g
, so it only replaces the first uppercase character:
https://github.com/developit/preact-compat/blob/6029c6e25f6d1c6461d5cc24a9c8bdc781f6ab87/src/index.js#L123
Is there a temporary workaround until this is fixed?
@ikoruk this bit me today. With the g
flag it gets converted to kebab which isn't the solution as far as I can tell with. Is there a way to denylist certain attributes, or svg attributes as a whole? I'm not super familiar with the internals.