Skip to content

SVG issues with className #233

Closed
@PaulBGD

Description

@PaulBGD

Basically you can't just svgElement.className because SVGs are unique in that they have 2 class names. The best solution for this is to do svgElement.setAttribute('class', value)

You can see this in action by doing:

var svg = document.createElementNS( 'http://www.w3.org/2000/svg', 'svg' )
svg.className = 'my-class-name';
svg.className // doesn't return our set className, instead the special svg object

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions