Skip to content

v4 error: Cannot set property className of #<SVGElement> which has only a getter #87

@greghuc

Description

@greghuc

Hi there,

This is a very short and incomplete bug report for v4.1.5. I did a quick try of v4 in my app (currently on v3.2.2), and I'm seeing some errors. I don't have time right now to give a nice reproduction case, but I thought you might want to know about this error now, as you are actively developing v4..

So the error is "Cannot set property className of #<SVGElement> which has only a getter".

This happens with this code:

    V.svg`<svg class="blaa" xmlns="http://www.w3.org/2000/svg"> ... </svg>`

A quick Google shows up a related Github 2015 issue of this: adobe-webplatform/Snap.svg#414, where someone commented "SVG elements don't seem to respond to setting the className property."

The v4 release notes say "both class and style are handled as special attributes (among aria, data and ref) so that class=${value} now directly set className of the element".

So maybe setting className doesn't work on svgs?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions