JsBarcode
JsBarcode copied to clipboard
getRenderProperties doesn't recognize svg element
There is a bug in helper/getRenderProperties:
element && element.nodeName === 'svg'
This is caused by the fact browser can sometimes return nodeName UPPERCASE (see https://johnresig.com/blog/nodename-case-sensitivity/).
Therefore:
var element = document.createElementNS("http://www.w3.org/2000/svg", "svg"); JsBarcode(element, '123456789012', {format: "ean13"});
will work, but:
var element = document.createElement("svg"); JsBarcode(element, '123456789012', {format: "ean13"});
will throw an exception.
I can relate to that problem and would like to thank you for providing a workaround.
Under Google Chrome 88.0.4324.182 and Windows 10 v19041.804, document.createElement('svg').nodeName
yields "SVG"
.
Edit: I've been using [email protected]. Looks like #346 fixed it for newer versions. I guess the issue can be closed now.