iconfu/svg-inject

'title' attribute not handled properly if namespaced title exists

waruyama opened this issue · 2 comments

Currently, if a title attribute is specified in the <img> element and the injected SVG already has a namespaced title element (for example <svg:title>, a new title element is created and inserted before the existing namespaced `<title>´ element.

Instead the existing namespaced title element should be used and the content changed to the value of the img's title attribute.

Simple fix by using localName instead of tagName when checking for title element. Also, if a title element already exists, we should reuse it instead of replacing it with a new element.

just released Version 1.2.0 which fixes this issue