>  (defun svg--append (svg node)
> +  ;; id is expected to be unique.
>    (let ((old (and (dom-attr node 'id)
>                 (dom-by-id svg
>                               (concat "\\`" (regexp-quote (dom-attr node 'id))
>                                       "\\'")))))
>      (if old
> -        ;; FIXME: This was (dom-set-attributes old (dom-attributes node))
> -        ;; and got changed by commit f7ea7aa11f6211b5142bbcfc41c580d75485ca56
> -        ;; without any explanation.
> -     (setcdr (car old) (cdr node))
> -      (dom-append-child svg node)))
> +        ;; Remove old node. New node might be a different type.
> +        (mapc (lambda (a)
> +                  (dom-remove-node svg a))
> +                old))
> +    (dom-append-child svg node))

Hm...  I think this is basically correct, but it's a behaviour change --
previously svg--append wouldn't append if the ID already existed, but
would keep the save place in the structure, but with this change, it
really always appends.

So I don't think that's quite right -- the old behaviour was OK, I think
(but undocumented).
Existing code doesn't ensure ids are unique. Furthermore, in case id is duplicated, only the attributes on the first tag gets replaced. That's a little unpredictable behaviour from an API perspective.