Preact: 'clipPathUnits' svg attribute is getting converted to 'clip-pathunits'

Created on 23 Oct 2019  路  5Comments  路  Source: preactjs/preact

Input:

<svg>
  <clipPath id="hexagon" clipPathUnits="objectBoundingBox">
    <polygon points="0.5 0, 1 0.25, 1 0.75, 0.5 1, 0 0.75, 0 0.25" />
  </clipPath>
</svg>

output:

<svg>
  <clipPath id="hexagon" clip-pathunits="objectBoundingBox">
    <polygon points="0.5 0, 1 0.25, 1 0.75, 0.5 1, 0 0.75, 0 0.25" />
  </clipPath>
</svg>
beginner-friendly bug

Most helpful comment

This was fixed with #2251 and it was released as part of 10.3.1 :tada:

All 5 comments

This is cause our SVG property normalization regex short circuts on clip cuz it thinks the property is clip-path which is kebab-case. We need to teach the normalization about clipPathUnits which should skip this normalization since that's the actual property name in this instance

One other option here would be to investigate allowing SVG props to use properties instead of attributes. In order to do so, we'd have to account for the fact that most SVG properties are animatedValue or other odd wrapper types.

For example, I believe this case would be node.clipPathUnits.baseValue = 'objectBoundingBox'

This was fixed with #2251 and it was released as part of 10.3.1 :tada:

In the current version there are still issues with incorrect renamings. For example markerHeight and markerWidth get converted to marker-height and marker-width which are not valid.

@moklick Can you file a new issue for that? Comments on closed issues quickly get lost in GitHub's ui, which makes it pretty hard for us to track work.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kossnocorp picture kossnocorp  路  3Comments

KnisterPeter picture KnisterPeter  路  3Comments

nopantsmonkey picture nopantsmonkey  路  3Comments

mizchi picture mizchi  路  3Comments

youngwind picture youngwind  路  3Comments