Skip to content

mutate the svg in-place

stuebinm requested to merge stuebinm/divoc-bb3-logo-generator:mutable-svg into master

this changes the update() function to mutate the svg in-place instead of re-serialising and then letting the browser re-parse it each time, which avoids (a) having to copy the entire svg object (including the font blob as string) and (b) having to first serialise and then parse it again (also including the blob).

The result is text editing with no discernable delay while typing.

This does mean that the svg is now embedded directly and may e.g. share its id namespace, though that doesn't appear to be a problem with the current template and also shouldn't be a problem in general as long as the svg itself isn't user-generated.

Merge request reports