Behavior
I use an external Javascript code that replaces some SVG elements dynamically based on their attributes. The Javascript code first checks for the type of the element to validate, that it is an SVGElement like this:
The code returns True in Firefox but False in Safari and Chrome although I can verify in the Chrome Properties tab, that it is indeed of type SVGElement.
How I create the SVG Element
I tried different things but ended up using a Plugin.
Of course there is nothing wrong with the generated HTML-Code when using it, as browsers will then use the correct SVG - it is just not showing up when editing in GrapesJS.
The code returns True in Firefox but False in Safari and Chrome although I can verify in the Chrome Properties tab, that it is indeed of type SVGElement.
Behavior I use an external Javascript code that replaces some SVG elements dynamically based on their attributes. The Javascript code first checks for the type of the element to validate, that it is an SVGElement like this:
document.querySelector('#someId') instanceof SVGElement
The code returns True in Firefox but False in Safari and Chrome although I can verify in the Chrome Properties tab, that it is indeed of type SVGElement.
How I create the SVG Element I tried different things but ended up using a Plugin.
component.js
blocks.js
Additional Information According to this: https://stackoverflow.com/questions/24174975/document-createelementsvg-instanceof-svgelement-is-false SVG elements are special, but from what I can see in src/dom_components/view/ComponentSvgView.js I assume, that they are created correctly.
Of course there is nothing wrong with the generated HTML-Code when using it, as browsers will then use the correct SVG - it is just not showing up when editing in GrapesJS.