javascript - Check if the variable is a SVG.js element instance -


i'm using svg.js library.

how can check if variable x instance of svg class?


i tried:

new svg(document.createdocumentfragment()) instanceof svg     // false new svg(document.createdocumentfragment()).contructor === svg // false 

checking value svg function returns find new element created , returned. instance of 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, solution is:

new svg(document.createdocumentfragment()) instanceof svg.doc // true  // or using x variable var x = new svg(document.createdocumentfragment()); x instanceof svg.doc // true 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -