I'm using beginElement()
to start an SVG animation in my web app:
document.getElementById("item").beginElement();
But this causes the following error in IE9 and up (which doesn't support it):
Object doesn't support property or method 'beginElement'
I don't mind the animation not working in IE9, but I need to prevent the error from occurring. How do I set up a check so that beginElement()
only gets called if the browser supports it? E.g.:
if (hasSupport) {
document.getElementById("item").beginElement();
}
I tried a detection technique like this:
return !!document.getElementById("item").beginElement();
But that always returns false
, even in browsers that I know support it (like Firefox).
I also looked at using Modernizr, but it doesn't have a test for beginElement()
.