In this example below, why does the draw.clear()
method throw the error TypeError: Cannot read property 'parentNode' of undefined at create.clear
? What can I do to get the clear method to work and not throw any errors?
import * as SVG from 'svg.js';
import 'svg.filter.js';
// create the svg
let draw = new SVG.Doc('root');
draw.size('100vw', '100vh');
// create a rect with a dropshadow
let rect = draw.rect(100, 50).x(50).y(80).fill('red').stroke({
color: 'green',
width: 10
})
draw.clear()