I'm creating an SVG using JSDOM and D3, and then writing it to an SVG file using FS in a Node environment. This SVG has event handlers attached to it for "drag" events, but these handlers are not being preserved in the written file.
How can I keep all event handlers associated with an SVG DOM when writing that SVG to a file?
CodePudding user response:
I don't think you can serialize event handlers. I would save the parameters of the handler in the html using the dataset property of DOM elements. Then when you reload the svg element you can call an initializer routine to reset the event handlers.
