[英]Check if the variable is a SVG.js element instance
Checking what value SVG
function returns we find that a new element
is created and returned. 检查
SVG
函数返回的值后,我们发现已创建并返回了一个新element
。 It is an instance of SVG.Doc
: 它是
SVG.Doc
一个实例:
> SVG
svg.js:12 function (element) {
if (SVG.supported) {
element = new SVG.Doc(element)
if (!SVG.parser)
SVG.prepare(element)
return element
}
}
So, the solution is: 因此,解决方案是:
new SVG(document.createDocumentFragment()) instanceof SVG.Doc // true
// or using the x variable
var x = new SVG(document.createDocumentFragment());
x instanceof SVG.Doc // true
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.