Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

textLength should not be kebap-cased #483

Open
chrisv2 opened this issue Jul 4, 2018 · 4 comments
Open

textLength should not be kebap-cased #483

chrisv2 opened this issue Jul 4, 2018 · 4 comments

Comments

@chrisv2
Copy link

chrisv2 commented Jul 4, 2018

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
@itslevo
Copy link

itslevo commented Jul 27, 2018

Can confirm, clipPathUnits gets rendered as clip-pathunits.

@developit
Copy link
Member

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

@ikoruk
Copy link

ikoruk commented Jan 16, 2019

Is there a temporary workaround until this is fixed?

@itsthesteve
Copy link

@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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants