Are there really any canvas implementations that don't support 2D? 

One concern here is that you're leaking that element. If you wrapped this detection in a closure, you could fix that.