question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SVG strokeWidth is not templated to stroke-width

See original GitHub issue

In react strokeWidth templates to valid svg prop stroke-width, but it’s not the case for preact. Cannot find in code how to fix it.(

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
NateRadebaughcommented, Feb 28, 2018

I did some investigation into the spec for SVG and it looks like there isn’t any clear pattern for what formats are expected/valid. It seems like if we were to support these, we’d need to explicitly define a mapping. This would likely add more bloat to the preact source than is preferred.

Perhaps if there is interest it may be worthwhile to create a separate compat sort of addon that would support SVG?

1reaction
developitcommented, Aug 20, 2017

Hiya - SVG property renaming is handled in preact-compat. Preact core simply uses attributes for SVG, since SVG reflected properties are read-only.

That said, it might be worth exploring the idea of applying a simple transform (here) when we know we’re mutating an SVG:

name = name.replace(/([A-Z])/g, '-$1')
Read more comments on GitHub >

github_iconTop Results From Across the Web

svg - stroke-width doesn't scale; aspect ratio problem?
The best solution I can think of is to manually transform the coordinates of your path. vector-effect="non-scaling-vector" is not consistently ...
Read more >
stroke-width - CSS-Tricks
The stroke-width property in CSS is for setting the width of a border on SVG shapes.
Read more >
181122 - SVG stroke-width isn't scaled down properly when ...
When SVG is scaled down, the "stroke" (border) does not scale down with the shape. The end result is that when zoomed out,...
Read more >
Stroke Width - Tailwind CSS
Utilities for styling the stroke width of SVG elements. ... to the stroke-width CSS property here so you can make your custom rows...
Read more >
Imported SVG's stroke width out of proportion in QGIS
I can't see what should be wrong with it and it works fine in any vector editor, but not in QGIS. qgis ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found