Last modified: 2014-03-13 17:45:19 UTC
surface.disconnect( this, { 'toolbarPosition': 'positionPhantoms' } ); This throws Uncaught TypeError: Cannot read property 'length' of undefined when no such event has been bound first. oo.EventEmitter.prototype.disconnect = function ( context, methods ) { /* .. */ for ( event in methods ) { method = methods[event]; /* .. */ bindings = this.bindings[event]; i = bindings.length; /* ! */ It should silently skip it. ---- Moved from https://github.com/trevorparscal/oojs/issues/18.
The no-op feature to allow calling disconnect() when no events are bound yet already exists. Change Ibe1d4747c05 adds tests to reflect this. However when passing a host object that not only contains event handlers for events not (yet) bound, but explicitly specifying methods to unbind, then those methods have to exist (it's fine if they aren't bound as listeners, but they have to exist).