Prosemirror: SVG uncaught error: Cannot assign to read only property 'className'

Created on 28 Jul 2016  路  3Comments  路  Source: ProseMirror/prosemirror

0.9.0

On first menu render, I'm getting this uncaught error:

Cannot assign to read only property 'className' of object '#'

from https://github.com/ProseMirror/prosemirror/blob/62f0864cb784ff515219c440a5f48b5ada72e4e0/src/menu/icons.js#L38-L39 ... should that be collection.classList.add(...)?

Most helpful comment

For an SVG element, className is not a string, but an instance of SVGAnimatedString.

So svg.className.baseVal = ... or svg.setAttribute("class", ...) or svg.classList.add(...) or...

All 3 comments

This seems to work on the browser's I'm testing with. Why would an <svg> element have a writable classList but no writable className?

For an SVG element, className is not a string, but an instance of SVGAnimatedString.

So svg.className.baseVal = ... or svg.setAttribute("class", ...) or svg.classList.add(...) or...

Ugh, I wasn't even trying to set className, that should be id instead. Attached patch fixes this.

Was this page helpful?
0 / 5 - 0 ratings