Resolved compatibility issues with CocoonJS

With this fix KineticJS should be compatible with [CocoonJS](http://www.ludei.com/tech/cocoonjs) out of the box.