When I tried the code document.createElement("svg") instanceof SVGElement
in chrome it returns false
. Why?
Creating an element like <svg>
not in any context and out of thin air will create an unknown element. If you want to create an SVG element use:
var a = document.createElementNS("http://www.w3.org/2000/svg", "svg");
Now if you compare:
var result = a instanceof SVGElement;
the result
will be true
.
See a working example in this JSFiddle
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With