Finding support for beginElement ()
I am using beginElement()
to trigger SVG animation in my web application:
document.getElementById("item").beginElement();
But this throws the following error in IE9 and up (which doesn't support it ):
Object doesn't support property or method 'beginElement'
I don't mind animations not working in IE9, but I need to prevent the error from appearing. How to set up a check to beginElement()
is called only when the browser supports it? For example:.
if (hasSupport) {
document.getElementById("item").beginElement();
}
I tried a detection method like this :
return !!document.getElementById("item").beginElement();
But this always returns false
, even on browsers that I know support it (Firefox for example).
I've also considered using Modernizr , but it doesn't have a test case for beginElement()
.
+3
source to share