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.

Camel Case properties in SVG's

See original GitHub issue

I have a custom element that handles creating SVG elements. In the svg element itself, I bind the view box property and the rest to the element like so:

<svg viewBox="${viewBox}" x="${svgX}" y="${svgY}">...</svg>

Since the update (seemingly related to this particular part about camel case https://github.com/aurelia/binding/commit/315cfaa229c13da8355ee1dec201a09c7df507db) properties that are camel case in the svg (such as viewBox) no longer display, while other properties like x and y display fine.
Also, to further define the problem, it appears that the binding for camel case properties breaks when using string interpolation. For example, this works:

<svg viewBox="0 0 48 48" x="${svgX}" y="${svgY}">...</svg>

while this doesn’t (the viewBox property does not show in the element):

<svg viewBox="0 0 48 ${svgHeight}" x="${svgX}" y="${svgY}">...</svg>

Another use case is that dropping the .bind and simply using view-box as a property works:

<svg view-box="${viewBox}" x="${svgX}" y="${svgY}">...</svg>

This doesn’t seem right, because view-box is not a valid svg property. It seems that the binding engine is taking any property that has a dash in it and converting it to camel case (could be wrong, but it appears to be the case here)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jdanyowcommented, May 6, 2016

@AStoker / @Scapal - there’s a new build of templating-binding and templating-resources available- let me know if you run into any further issues with this release.

0reactions
EisenbergEffectcommented, May 4, 2016

@jdanyow Looks like we have a regression here with respect to SVG. Is this going to be easy to address?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Chrome doesn't respect camelcase for svg element "clippath"
When rendered to the dom, it changes the element to lowercase clippath, which isn't recognized by the svg (must be camelcased as clipPath)....
Read more >
SVG Attribute reference - SVG: Scalable Vector Graphics | MDN
SVG elements can be modified using attributes that specify details about exactly how the element should be handled or rendered.
Read more >
A complete guide to using CSS filters with SVGs
In this post, we're going to learn about a unique and powerful set of CSS tools, SVG filters, to improve visual aspects of...
Read more >
Styling — SVG 2
Elements in an SVG document can be styled using CSS. Most visual characteristics and some aspects of element geometry are controlled using CSS...
Read more >
Styling And Animating SVGs With CSS - Smashing Magazine
SVGs can be animated the same way that HTML elements can, using CSS keyframes and animation properties or using CSS transitions.
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